AscEmu
OpenSource WoW Emulator
Loading...
Searching...
No Matches
WorldSession Class Reference

#include <WorldSession.h>

Collaboration diagram for WorldSession:
[legend]

Public Member Functions

 WorldSession (uint32_t id, std::string name, WorldSocket *sock)
 
 ~WorldSession ()
 
void SendPacket (WorldPacket *packet)
 
void OutPacket (uint16_t opcode)
 
void SendChatPacket (WorldPacket *data, uint32_t langpos, int32_t lang, WorldSession *originator)
 
uint32_t GetAccountId () const
 
PlayerGetPlayer ()
 
PlayerGetPlayerOrThrow ()
 
void SetAccountFlags (uint32_t)
 
bool HasFlag (uint32_t flag)
 
uint32_t GetFlags ()
 
void LoadSecurity (std::string securitystring)
 
std::unique_ptr< char[]> GetPermissions () const
 
bool hasPermissions () const
 
bool hasPermission (const char *requiredPermission) const
 
bool HasGMPermissions () const
 
bool CanUseCommand (char cmdstr)
 
bool canUseCommand (const std::string &cmdstr) const
 
void SetSocket (WorldSocket *sock)
 
void SetPlayer (Player *plr)
 
void SetAccountData (uint32_t index, std::unique_ptr< char[]> data, bool initial, uint32_t sz)
 
AccountDataEntryGetAccountData (uint32_t index)
 
void SetLogoutTimer (uint32_t ms)
 
void LogoutPlayer (bool Save)
 
void QueuePacket (std::unique_ptr< WorldPacket > packet)
 
void OutPacket (uint16_t opcode, uint16_t len, const void *data)
 
WorldSocketGetSocket ()
 
void Disconnect ()
 
uint8_t Update (uint32_t InstanceID)
 
void SendNotification (const char *message,...)
 
void SetInstance (uint32_t Instance)
 
uint32_t GetLatency () const
 
std::string GetAccountName ()
 
const char * GetAccountNameS () const
 
const char * LocalizedWorldSrv (uint32_t id)
 
const char * LocalizedGossipOption (uint32_t id)
 
const char * LocalizedMapName (uint32_t id)
 
const char * LocalizedBroadCast (uint32_t id)
 
uint16_t GetClientBuild ()
 
void SetClientBuild (uint16_t build)
 
uint32_t GetInstance ()
 
bool IsLoggingOut ()
 
void sendBattlegroundList (Creature *creature, uint32_t mapId)
 
void sendCalendarRaidLockout (InstanceSaved const *save, bool add)
 
void sendCalendarRaidLockoutUpdated (InstanceSaved const *save)
 
void loadPlayerFromDBProc (QueryResultVector &results)
 
uint8_t deleteCharacter (WoWGuid guid)
 
void initGMMyMaster ()
 
void sendServerStats ()
 
void fullLogin (Player *player)
 
void characterEnumProc (QueryResult *result)
 
void loadAccountDataProc (QueryResult *result)
 
bool isSessionMuted ()
 
bool isFloodProtectionTriggered ()
 
void sendEmptyGroupList (Player *player)
 
void sendInventoryList (Creature *pCreature)
 
void sendBuyFailed (uint64_t guid, uint32_t itemid, uint8_t error)
 
void sendSellItem (uint64_t vendorguid, uint64_t itemid, uint8_t error)
 
void handleVoidStorageUnlock (WorldPacket &recvData)
 
void handleVoidStorageQuery (WorldPacket &recvData)
 
void handleVoidStorageTransfer (WorldPacket &recvData)
 
void handleVoidSwapItem (WorldPacket &recvData)
 
void sendVoidStorageTransferResult (uint8_t result)
 
void handleTransmogrifyItems (WorldPacket &recvData)
 
void handleReforgeItemOpcode (WorldPacket &recvData)
 
void sendReforgeResult (bool success)
 
void sendRefundInfo (uint64_t guid)
 
void sendLfgUpdateSearch (bool update)
 
void sendLfgDisabled ()
 
void sendLfgOfferContinue (uint32_t dungeonEntry)
 
void sendLfgTeleportError (uint8_t error)
 
void sendLfgJoinResult (const LfgJoinResultData &joinData)
 
void sendLfgUpdatePlayer (const LfgUpdateData &updateData)
 
void sendLfgUpdateParty (const LfgUpdateData &updateData)
 
void sendLfgRoleChosen (uint64_t guid, uint8_t roles)
 
void sendLfgRoleCheckUpdate (const LfgRoleCheck *pRoleCheck)
 
void sendLfgQueueStatus (uint32_t dungeon, int32_t waitTime, int32_t avgWaitTime, int32_t waitTimeTanks, int32_t waitTimeHealer, int32_t waitTimeDps, uint32_t queuedTime, uint8_t tanks, uint8_t healers, uint8_t dps)
 
void sendLfgPlayerReward (uint32_t RandomDungeonEntry, uint32_t DungeonEntry, uint8_t done, const LfgReward *reward, QuestProperties const *qReward)
 
void sendLfgBootPlayer (const LfgPlayerBoot *pBoot)
 
void sendLfgUpdateProposal (uint32_t proposalId, const LfgProposal *pProp)
 
LootgetItemLootFromHighGuidType (WoWGuid wowGuid)
 
LootgetMoneyLootFromHighGuidType (WoWGuid wowGuid)
 
void sendAccountDataTimes (uint32_t mask)
 
void sendMOTD ()
 
void sendClientCacheVersion (uint32_t version)
 
bool isAddonRegistered (const std::string &addon_name) const
 
void readAddonInfoPacket (ByteBuffer &recvPacket)
 
void sendAddonInfo ()
 
void sendTabardHelp (Creature *creature)
 
void sendBankerList (Creature *creature)
 
void sendAuctionList (Creature *creature)
 
void sendSpiritHealerRequest (Creature *creature)
 
void sendCharterRequest (Creature *creature)
 
void sendInnkeeperBind (Creature *creature)
 
void sendTrainerList (Creature *creature)
 
void sendStabledPetList (uint64_t npcguid)
 
TrainerSpellState trainerGetSpellStatus (TrainerSpell const *trainerSpell) const
 
std::unique_ptr< WorldPacketbuildQuestQueryResponse (QuestProperties const *qst)
 
void sendTaxiStatus (WoWGuid guid)
 
void sendTaxiMenu (Creature *unit)
 
void sendDoFlight (uint32_t mountDisplayId, uint32_t path, uint32_t pathNode=0)
 
bool sendLearnNewTaxiNode (Creature *unit)
 
void sendDiscoverNewTaxiNode (uint32_t nodeid)
 
void sendTradeUpdate (bool tradeState=true)
 
void sendTradeResult (TradeStatus result, uint64_t guid=0)
 
void SystemMessage (const char *format,...)
 
void sendSystemMessagePacket (std::string &_message)
 
template<typename... Args>
void systemMessage (const std::string &format, Args &&... args)
 

Static Public Member Functions

static void registerOpcodeHandler ()
 

Public Attributes

Playerm_loggingInPlayer
 
uint32_t m_currMsTime
 
uint32_t m_lastPing
 
uint32_t m_loginTime
 
bool bDeleted
 
std::mutex deleteMutex
 
int32_t m_moveDelayTime
 
int32_t m_clientTimeDelay
 
float m_wLevel
 
bool m_bIsWLevelSet
 
uint32_t floodLines
 
time_t floodTime
 
uint32_t language
 
uint32_t m_muted
 

Protected Member Functions

void handleAreaTriggerOpcode (WorldPacket &recvPacket)
 
void handleArenaTeamQueryOpcode (WorldPacket &recvPacket)
 
void handleArenaTeamAddMemberOpcode (WorldPacket &recvPacket)
 
void handleArenaTeamRemoveMemberOpcode (WorldPacket &recvPacket)
 
void handleArenaTeamInviteAcceptOpcode (WorldPacket &)
 
void handleArenaTeamInviteDenyOpcode (WorldPacket &)
 
void handleArenaTeamLeaveOpcode (WorldPacket &recvPacket)
 
void handleArenaTeamDisbandOpcode (WorldPacket &recvPacket)
 
void handleArenaTeamPromoteOpcode (WorldPacket &recvPacket)
 
void handleArenaTeamRosterOpcode (WorldPacket &recvPacket)
 
void handleInspectArenaStatsOpcode (WorldPacket &recvPacket)
 
void handleAuctionHelloOpcode (WorldPacket &recvPacket)
 
void handleAuctionListItems (WorldPacket &recvPacket)
 
void handleAuctionListBidderItems (WorldPacket &recvPacket)
 
void handleAuctionSellItem (WorldPacket &recvPacket)
 
void handleAuctionListOwnerItems (WorldPacket &recvPacket)
 
void handleAuctionPlaceBid (WorldPacket &recvPacket)
 
void handleCancelAuction (WorldPacket &recvPacket)
 
void handleAuctionListPendingSales (WorldPacket &recvPacket)
 
void handleBattlefieldPortOpcode (WorldPacket &recvPacket)
 
void handleBattlefieldStatusOpcode (WorldPacket &)
 
void handleBattleMasterHelloOpcode (WorldPacket &recvPacket)
 
void handleLeaveBattlefieldOpcode (WorldPacket &)
 
void handleAreaSpiritHealerQueryOpcode (WorldPacket &recvPacket)
 
void handleAreaSpiritHealerQueueOpcode (WorldPacket &recvPacket)
 
void handleBattlegroundPlayerPositionsOpcode (WorldPacket &)
 
void handleArenaJoinOpcode (WorldPacket &recvPacket)
 
void handleBattleMasterJoinOpcode (WorldPacket &recvPacket)
 
void handleInspectHonorStatsOpcode (WorldPacket &recvPacket)
 
void handlePVPLogDataOpcode (WorldPacket &)
 
void handleBattlefieldListOpcode (WorldPacket &recvPacket)
 
void handleRequestRatedBgInfoOpcode (WorldPacket &recvPacket)
 
void handleRequestRatedBgStatsOpcode (WorldPacket &)
 
void handleRequestPvPRewardsOpcode (WorldPacket &)
 
void handleRequestPvpOptionsOpcode (WorldPacket &)
 
void handleCalendarGetCalendar (WorldPacket &)
 
void handleCalendarComplain (WorldPacket &recvPacket)
 
void handleCalendarGetNumPending (WorldPacket &)
 
void handleCalendarAddEvent (WorldPacket &recvPacket)
 
void handleCalendarGetEvent (WorldPacket &recvPacket)
 
void handleCalendarGuildFilter (WorldPacket &recvPacket)
 
void handleCalendarArenaTeam (WorldPacket &recvPacket)
 
void handleCalendarUpdateEvent (WorldPacket &recvPacket)
 
void handleCalendarRemoveEvent (WorldPacket &recvPacket)
 
void handleCalendarCopyEvent (WorldPacket &recvPacket)
 
void handleCalendarEventInvite (WorldPacket &recvPacket)
 
void handleCalendarEventRsvp (WorldPacket &recvPacket)
 
void handleCalendarEventRemoveInvite (WorldPacket &recvPacket)
 
void handleCalendarEventStatus (WorldPacket &recvPacket)
 
void handleCalendarEventModeratorStatus (WorldPacket &recvPacket)
 
void handleChannelJoin (WorldPacket &recvPacket)
 
void handleChannelLeave (WorldPacket &recvPacket)
 
void handleChannelList (WorldPacket &recvPacket)
 
void handleChannelPassword (WorldPacket &recvPacket)
 
void handleChannelSetOwner (WorldPacket &recvPacket)
 
void handleChannelOwner (WorldPacket &recvPacket)
 
void handleChannelModerator (WorldPacket &recvPacket)
 
void handleChannelUnmoderator (WorldPacket &recvPacket)
 
void handleChannelMute (WorldPacket &recvPacket)
 
void handleChannelUnmute (WorldPacket &recvPacket)
 
void handleChannelInvite (WorldPacket &recvPacket)
 
void handleChannelKick (WorldPacket &recvPacket)
 
void handleChannelBan (WorldPacket &recvPacket)
 
void handleChannelUnban (WorldPacket &recvPacket)
 
void handleChannelAnnounce (WorldPacket &recvPacket)
 
void handleChannelModerate (WorldPacket &recvPacket)
 
void handleGetChannelMemberCount (WorldPacket &recvPacket)
 
void handleChannelRosterQuery (WorldPacket &recvPacket)
 
void handleSetFactionAtWarOpcode (WorldPacket &recvPacket)
 
void handleSetFactionInactiveOpcode (WorldPacket &recvPacket)
 
void handleCharDeleteOpcode (WorldPacket &recvPacket)
 
void handlePlayerLoginOpcode (WorldPacket &recvPacket)
 
void handleCharRenameOpcode (WorldPacket &recvPacket)
 
void handleCharCreateOpcode (WorldPacket &recvPacket)
 
void handleSetPlayerDeclinedNamesOpcode (WorldPacket &recvPacket)
 
void handleCharEnumOpcode (WorldPacket &)
 
void handleCharFactionOrRaceChange (WorldPacket &recvPacket)
 
void handleCharCustomizeLooksOpcode (WorldPacket &recvPacket)
 
void handleMessageChatOpcode (WorldPacket &recvPacket)
 
void handleTextEmoteOpcode (WorldPacket &recvPacket)
 
void handleEmoteOpcode (WorldPacket &recvPacket)
 
void handleReportSpamOpcode (WorldPacket &recvPacket)
 
void handleChatIgnoredOpcode (WorldPacket &recvPacket)
 
void handleChatChannelWatchOpcode (WorldPacket &recvPacket)
 
void handleAttackSwingOpcode (WorldPacket &recvPacket)
 
void handleAttackStopOpcode (WorldPacket &)
 
void handleDuelAccepted (WorldPacket &)
 
void handleDuelCancelled (WorldPacket &)
 
void handleGMTicketCreateOpcode (WorldPacket &recvPacket)
 
void handleGMTicketUpdateOpcode (WorldPacket &recvPacket)
 
void handleGMTicketDeleteOpcode (WorldPacket &)
 
void handleGMSurveySubmitOpcode (WorldPacket &recvPacket)
 
void handleReportLag (WorldPacket &recvPacket)
 
void handleGMTicketGetTicketOpcode (WorldPacket &)
 
void handleGMTicketSystemStatusOpcode (WorldPacket &)
 
void handleGMTicketToggleSystemStatusOpcode (WorldPacket &)
 
void handleItemRefundInfoOpcode (WorldPacket &recvPacket)
 
void handleItemRefundRequestOpcode (WorldPacket &recvPacket)
 
void handleUseItemOpcode (WorldPacket &recvPacket)
 
void handleSwapItemOpcode (WorldPacket &recvPacket)
 
void handleSplitOpcode (WorldPacket &recvPacket)
 
void handleSwapInvItemOpcode (WorldPacket &recvPacket)
 
void handleDestroyItemOpcode (WorldPacket &recvPacket)
 
void handleAutoEquipItemOpcode (WorldPacket &recvPacket)
 
void handleAutoEquipItemSlotOpcode (WorldPacket &recvPacket)
 
void handleItemQuerySingleOpcode (WorldPacket &recvPacket)
 
void handleBuyBackOpcode (WorldPacket &recvPacket)
 
void handleSellItemOpcode (WorldPacket &recvPacket)
 
void handleBuyItemInSlotOpcode (WorldPacket &recvPacket)
 
void handleBuyItemOpcode (WorldPacket &recvPacket)
 
void handleListInventoryOpcode (WorldPacket &recvPacket)
 
void handleAutoStoreBagItemOpcode (WorldPacket &recvPacket)
 
void handleReadItemOpcode (WorldPacket &recvPacket)
 
void handleRepairItemOpcode (WorldPacket &recvPacket)
 
void handleAutoBankItemOpcode (WorldPacket &recvPacket)
 
void handleAutoStoreBankItemOpcode (WorldPacket &recvPacket)
 
void handleCancelTemporaryEnchantmentOpcode (WorldPacket &recvPacket)
 
void handleInsertGemOpcode (WorldPacket &recvPacket)
 
void handleWrapItemOpcode (WorldPacket &recvPacket)
 
void handleEquipmentSetUse (WorldPacket &recvPacket)
 
void handleEquipmentSetSave (WorldPacket &recvPacket)
 
void handleEquipmentSetDelete (WorldPacket &recvPacket)
 
void handleLfgSetCommentOpcode (WorldPacket &recvPacket)
 
void handleLfgLockInfoOpcode (WorldPacket &recvPacket)
 
void handleLfgJoinOpcode (WorldPacket &recvPacket)
 
void handleLfgLeaveOpcode (WorldPacket &recvPacket)
 
void handleLfgSearchOpcode (WorldPacket &recvPacket)
 
void handleLfgSearchLeaveOpcode (WorldPacket &recvPacket)
 
void handleLfgProposalResultOpcode (WorldPacket &recvPacket)
 
void handleLfgSetRolesOpcode (WorldPacket &recvPacket)
 
void handleLfgSetBootVoteOpcode (WorldPacket &recvPacket)
 
void handleLfgPlayerLockInfoRequestOpcode (WorldPacket &recvPacket)
 
void handleLfgTeleportOpcode (WorldPacket &recvPacket)
 
void handleLfgPartyLockInfoRequestOpcode (WorldPacket &recvPacket)
 
void handleAutostoreLootItemOpcode (WorldPacket &recvPacket)
 
void handleLootMoneyOpcode (WorldPacket &)
 
void handleLootOpcode (WorldPacket &recvPacket)
 
void handleLootReleaseOpcode (WorldPacket &recvPacket)
 
void handleLootMasterGiveOpcode (WorldPacket &recvPacket)
 
void doLootRelease (WoWGuid lguid)
 
void handleGetMailOpcode (WorldPacket &)
 
void handleSendMailOpcode (WorldPacket &recvPacket)
 
void handleTakeMoneyOpcode (WorldPacket &recvPacket)
 
void handleTakeItemOpcode (WorldPacket &recvPacket)
 
void handleMarkAsReadOpcode (WorldPacket &recvPacket)
 
void handleReturnToSenderOpcode (WorldPacket &recvPacket)
 
void handleMailDeleteOpcode (WorldPacket &recvPacket)
 
void handleItemTextQueryOpcode (WorldPacket &recvPacket)
 
void handleMailTimeOpcode (WorldPacket &)
 
void handleMailCreateTextItemOpcode (WorldPacket &recvPacket)
 
void handleStandStateChangeOpcode (WorldPacket &recvPacket)
 
void handleWhoOpcode (WorldPacket &recvPacket)
 
void handleSetSelectionOpcode (WorldPacket &recvPacket)
 
void handleTogglePVPOpcode (WorldPacket &)
 
void handleTutorialFlag (WorldPacket &recvPacket)
 
void handleTutorialClear (WorldPacket &)
 
void handleTutorialReset (WorldPacket &)
 
void handleLogoutRequestOpcode (WorldPacket &)
 
void handleSetSheathedOpcode (WorldPacket &recvPacket)
 
void handlePlayedTimeOpcode (WorldPacket &recvPacket)
 
void handleSetActionButtonOpcode (WorldPacket &recvPacket)
 
void handleSetWatchedFactionIndexOpcode (WorldPacket &recvPacket)
 
void handleRandomRollOpcode (WorldPacket &recvPacket)
 
void handleRealmSplitOpcode (WorldPacket &recvPacket)
 
void handleSetTaxiBenchmarkOpcode (WorldPacket &recvPacket)
 
void handleWorldStateUITimerUpdate (WorldPacket &)
 
void handleGameobjReportUseOpCode (WorldPacket &recvPacket)
 
void handleDungeonDifficultyOpcode (WorldPacket &recvPacket)
 
void handleRaidDifficultyOpcode (WorldPacket &recvPacket)
 
void handleInstanceLockResponse (WorldPacket &recvPacket)
 
void handleViolenceLevel (WorldPacket &recvPacket)
 
void handleSetAutoLootPassOpcode (WorldPacket &recvPacket)
 
void handleSetActionBarTogglesOpcode (WorldPacket &recvPacket)
 
void handleLootRollOpcode (WorldPacket &recvPacket)
 
void handleOpenItemOpcode (WorldPacket &recvPacket)
 
void handleDismountOpcode (WorldPacket &)
 
void handleToggleHelmOpcode (WorldPacket &)
 
void handleToggleCloakOpcode (WorldPacket &)
 
void handleResetInstanceOpcode (WorldPacket &)
 
void handleSetTitle (WorldPacket &recvPacket)
 
void handleZoneupdate (WorldPacket &recvPacket)
 
void handleResurrectResponse (WorldPacket &recvPacket)
 
void handleSelfResurrect (WorldPacket &)
 
void handleUpdateAccountData (WorldPacket &recvPacket)
 
void handleRequestAccountData (WorldPacket &recvPacket)
 
void handleBugOpcode (WorldPacket &recvPacket)
 
void handleSuggestionOpcode (WorldPacket &recvPacket)
 
void handleReturnToGraveyardOpcode (WorldPacket &)
 
void handleLogDisconnectOpcode (WorldPacket &recvPacket)
 
void handleCompleteCinematic (WorldPacket &)
 
void handleNextCinematic (WorldPacket &)
 
void handleReadyForAccountDataTimes (WorldPacket &)
 
void handleSummonResponseOpcode (WorldPacket &recvPacket)
 
void handleLogoutCancelOpcode (WorldPacket &)
 
void handlePlayerLogoutOpcode (WorldPacket &)
 
void handleCorpseReclaimOpcode (WorldPacket &recvPacket)
 
void handleLoadScreenOpcode (WorldPacket &recvPacket)
 
void handleUITimeRequestOpcode (WorldPacket &)
 
void handleTimeSyncRespOpcode (WorldPacket &recvPacket)
 
void handleObjectUpdateFailedOpcode (WorldPacket &recvPacket)
 
void handleRequestHotfix (WorldPacket &recvPacket)
 
void handleRequestCemeteryListOpcode (WorldPacket &)
 
void sendItemDb2Reply (uint32_t entry)
 
void sendItemSparseDb2Reply (uint32_t entry)
 
void handleRemoveGlyph (WorldPacket &recvPacket)
 
void handleBarberShopResult (WorldPacket &recvPacket)
 
void handleRepopRequestOpcode (WorldPacket &)
 
void handleWhoIsOpcode (WorldPacket &recvPacket)
 
void handleAmmoSetOpcode (WorldPacket &recvPacket)
 
void handleGameObjectUse (WorldPacket &recvPacket)
 
void handleInspectOpcode (WorldPacket &recvPacket)
 
void handleUnregisterAddonPrefixesOpcode (WorldPacket &)
 
void handleAddonRegisteredPrefixesOpcode (WorldPacket &recvPacket)
 
void handleReportOpcode (WorldPacket &recvPacket)
 
void handleReportPlayerOpcode (WorldPacket &recvPacket)
 
void HandleMirrorImageOpcode (WorldPacket &recvPacket)
 
void handleSetActiveMoverOpcode (WorldPacket &recvPacket)
 
void updatePlayerMovementVars (uint16_t opcode)
 
bool isHackDetectedInMovementData (uint16_t opcode)
 
void handleMovementOpcodes (WorldPacket &recvPacket)
 
void handleAcknowledgementOpcodes (WorldPacket &recvPacket)
 
void handleForceSpeedChangeAck (WorldPacket &recvPacket)
 
void handleWorldTeleportOpcode (WorldPacket &recvPacket)
 
void handleMountSpecialAnimOpcode (WorldPacket &)
 
void handleMoveWorldportAckOpcode (WorldPacket &)
 
void handleMoveTeleportAckOpcode (WorldPacket &recvPacket)
 
void handleMoveNotActiveMoverOpcode (WorldPacket &recvPacket)
 
void handleTabardVendorActivateOpcode (WorldPacket &recvPacket)
 
void handleBankerActivateOpcode (WorldPacket &recvPacket)
 
void handleBuyBankSlotOpcode (WorldPacket &recvPacket)
 
void handleTrainerListOpcode (WorldPacket &recvPacket)
 
void handleTrainerBuySpellOpcode (WorldPacket &recvPacket)
 
void handleCharterShowListOpcode (WorldPacket &recvPacket)
 
void handleGossipHelloOpcode (WorldPacket &recvPacket)
 
void handleGossipSelectOptionOpcode (WorldPacket &recvPacket)
 
void handleSpiritHealerActivateOpcode (WorldPacket &)
 
void handleNpcTextQueryOpcode (WorldPacket &recvPacket)
 
void handleBinderActivateOpcode (WorldPacket &recvPacket)
 
void handleStabledPetList (WorldPacket &recvPacket)
 
void handlePetAction (WorldPacket &recvPacket)
 
void handlePetNameQuery (WorldPacket &recvPacket)
 
void handleBuyStableSlot (WorldPacket &)
 
void handleStablePet (WorldPacket &)
 
void handleUnstablePet (WorldPacket &recvPacket)
 
void handleStableSwapPet (WorldPacket &recvPacket)
 
void handlePetRename (WorldPacket &recvPacket)
 
void handlePetAbandon (WorldPacket &)
 
void handlePetUnlearn (WorldPacket &recvPacket)
 
void handlePetSpellAutocast (WorldPacket &recvPacket)
 
void handlePetCancelAura (WorldPacket &recvPacket)
 
void handlePetLearnTalent (WorldPacket &recvPacket)
 
void handlePetSetActionOpcode (WorldPacket &recvPacket)
 
void handleDismissCritter (WorldPacket &recvPacket)
 
void handleGameObjectQueryOpcode (WorldPacket &recvPacket)
 
void handleQueryTimeOpcode (WorldPacket &recvPacket)
 
void handleCreatureQueryOpcode (WorldPacket &recvPacket)
 
void handleNameQueryOpcode (WorldPacket &recvPacket)
 
void handleInrangeQuestgiverQuery (WorldPacket &)
 
void handleCorpseQueryOpcode (WorldPacket &)
 
void handleItemNameQueryOpcode (WorldPacket &recvPacket)
 
void handlePageTextQueryOpcode (WorldPacket &recvPacket)
 
void handleAchievmentQueryOpcode (WorldPacket &recvPacket)
 
void handleQuestPushResultOpcode (WorldPacket &recvPacket)
 
void handleQuestgiverAcceptQuestOpcode (WorldPacket &recvPacket)
 
void handleQuestQueryOpcode (WorldPacket &recvPacket)
 
void handleQuestgiverCancelOpcode (WorldPacket &recvPacket)
 
void handleQuestgiverHelloOpcode (WorldPacket &recvPacket)
 
void handleQuestgiverStatusQueryOpcode (WorldPacket &recvPacket)
 
void handleQuestgiverChooseRewardOpcode (WorldPacket &recvPacket)
 
void handleQuestgiverRequestRewardOpcode (WorldPacket &recvPacket)
 
void handleQuestGiverQueryQuestOpcode (WorldPacket &recvPacket)
 
void handleQuestgiverCompleteQuestOpcode (WorldPacket &recvPacket)
 
void handleQuestlogRemoveQuestOpcode (WorldPacket &recvPacket)
 
void handlePushQuestToPartyOpcode (WorldPacket &recvPacket)
 
void handleQuestPOIQueryOpcode (WorldPacket &recvPacket)
 
void handleUnlearnSkillOpcode (WorldPacket &recvPacket)
 
void handleLearnTalentOpcode (WorldPacket &recvPacket)
 
void handleUnlearnTalents (WorldPacket &recvPacket)
 
void handleLearnMultipleTalentsOpcode (WorldPacket &recvPacket)
 
void handleLearnPreviewTalentsOpcode (WorldPacket &recvPacket)
 
void handleFriendListOpcode (WorldPacket &recvPacket)
 
void handleAddFriendOpcode (WorldPacket &recvPacket)
 
void handleDelFriendOpcode (WorldPacket &recvPacket)
 
void handleAddIgnoreOpcode (WorldPacket &recvPacket)
 
void handleDelIgnoreOpcode (WorldPacket &recvPacket)
 
void handleSetFriendNote (WorldPacket &recvPacket)
 
void handleSpellClick (WorldPacket &recvPacket)
 
void handleCastSpellOpcode (WorldPacket &recvPacket)
 
void handleCancelCastOpcode (WorldPacket &recvPacket)
 
void handleCancelAuraOpcode (WorldPacket &recvPacket)
 
void handleCancelChannellingOpcode (WorldPacket &recvPacket)
 
void handleCancelAutoRepeatSpellOpcode (WorldPacket &)
 
void handlePetCastSpell (WorldPacket &recvPacket)
 
void handleCancelTotem (WorldPacket &recvPacket)
 
void handleUpdateProjectilePosition (WorldPacket &recvPacket)
 
void handleTaxiNodeStatusQueryOpcode (WorldPacket &recvPacket)
 
void handleTaxiQueryAvaibleNodesOpcode (WorldPacket &recvPacket)
 
void handleEnabletaxiOpcode (WorldPacket &recvPacket)
 
void handleActivateTaxiOpcode (WorldPacket &recvPacket)
 
void handleMultipleActivateTaxiOpcode (WorldPacket &recvPacket)
 
void handleMoveSplineDoneOpcode (WorldPacket &recvPacket)
 
void handleInitiateTradeOpcode (WorldPacket &recvPacket)
 
void handleBeginTradeOpcode (WorldPacket &)
 
void handleBusyTrade (WorldPacket &)
 
void handleIgnoreTrade (WorldPacket &)
 
void handleAcceptTrade (WorldPacket &)
 
void handleUnacceptTrade (WorldPacket &)
 
void handleCancelTrade (WorldPacket &recvPacket)
 
void handleSetTradeItem (WorldPacket &recvPacket)
 
void handleClearTradeItem (WorldPacket &recvPacket)
 
void handleSetTradeGold (WorldPacket &recvPacket)
 
void handleDismissVehicle (WorldPacket &)
 
void handleRequestVehiclePreviousSeat (WorldPacket &)
 
void handleRequestVehicleNextSeat (WorldPacket &)
 
void handleRequestVehicleSwitchSeat (WorldPacket &recvPacket)
 
void handleChangeSeatsOnControlledVehicle (WorldPacket &recvPacket)
 
void handleRemoveVehiclePassenger (WorldPacket &recvPacket)
 
void handleLeaveVehicle (WorldPacket &)
 
void handleEnterVehicle (WorldPacket &recvPacket)
 
void Unhandled (WorldPacket &recvPacket)
 
void nothingToHandle (WorldPacket &recvPacket)
 

Private Types

typedef std::list< AddonEntryAddonsList
 

Private Member Functions

void handleGroupInviteResponseOpcode (WorldPacket &recvPacket)
 
void handleGroupSetRolesOpcode (WorldPacket &recvPacket)
 
void handleGroupRequestJoinUpdatesOpcode (WorldPacket &)
 
void handleGroupRoleCheckBeginOpcode (WorldPacket &recvPacket)
 
void handleGroupInviteOpcode (WorldPacket &recvPacket)
 
void handleGroupDeclineOpcode (WorldPacket &)
 
void handleGroupAcceptOpcode (WorldPacket &)
 
void handleGroupUninviteOpcode (WorldPacket &recvPacket)
 
void handleGroupUninviteGuidOpcode (WorldPacket &recvPacket)
 
void handleGroupDisbandOpcode (WorldPacket &)
 
void handleMinimapPingOpcode (WorldPacket &recvPacket)
 
void handleGroupSetLeaderOpcode (WorldPacket &recvPacket)
 
void handleLootMethodOpcode (WorldPacket &recvPacket)
 
void handleSetPlayerIconOpcode (WorldPacket &recvPacket)
 
void handlePartyMemberStatsOpcode (WorldPacket &recvPacket)
 
void handleConvertGroupToRaidOpcode (WorldPacket &)
 
void handleRequestRaidInfoOpcode (WorldPacket &)
 
void handleGroupChangeSubGroup (WorldPacket &recvPacket)
 
void handleGroupAssistantLeader (WorldPacket &recvPacket)
 
void handleGroupPromote (WorldPacket &recvPacket)
 
void handleReadyCheckOpcode (WorldPacket &recvPacket)
 
void handleGuildQuery (WorldPacket &recvPacket)
 
void handleInviteToGuild (WorldPacket &recvPacket)
 
void handleGuildInfo (WorldPacket &)
 
void handleSaveGuildEmblem (WorldPacket &recvPacket)
 
void handleGuildAccept (WorldPacket &)
 
void handleGuildDecline (WorldPacket &)
 
void handleGuildRoster (WorldPacket &)
 
void handleGuildLeave (WorldPacket &)
 
void handleGuildDisband (WorldPacket &)
 
void handleGuildLog (WorldPacket &)
 
void handleGuildPermissions (WorldPacket &)
 
void handleGuildBankBuyTab (WorldPacket &recvPacket)
 
void handleGuildBankLogQuery (WorldPacket &recvPacket)
 
void handleSetGuildBankText (WorldPacket &recvPacket)
 
void handleGuildLeader (WorldPacket &recvPacket)
 
void handleGuildMotd (WorldPacket &recvPacket)
 
void handleGuildAddRank (WorldPacket &recvPacket)
 
void handleSetGuildInfo (WorldPacket &recvPacket)
 
void handleGuildRemove (WorldPacket &recvPacket)
 
void handleGuildPromote (WorldPacket &recvPacket)
 
void handleGuildDemote (WorldPacket &recvPacket)
 
void handleGuildBankWithdrawMoney (WorldPacket &recvPacket)
 
void handleGuildBankDepositMoney (WorldPacket &recvPacket)
 
void handleGuildBankUpdateTab (WorldPacket &recvPacket)
 
void handleGuildBankSwapItems (WorldPacket &recvPacket)
 
void handleGuildBankQueryTab (WorldPacket &recvPacket)
 
void handleGuildBankerActivate (WorldPacket &recvPacket)
 
void handleGuildSetRank (WorldPacket &recvPacket)
 
void handleGuildBankMoneyWithdrawn (WorldPacket &)
 
void handleGuildSetPublicNote (WorldPacket &recvPacket)
 
void handleGuildSetOfficerNote (WorldPacket &recvPacket)
 
void handleGuildSetNoteOpcode (WorldPacket &recvPacket)
 
void handleGuildDelRank (WorldPacket &recvPacket)
 
void handleGuildBankQueryText (WorldPacket &recvPacket)
 
void handleQueryGuildBankTabText (WorldPacket &recvPacket)
 
void handleCharterShowSignatures (WorldPacket &recvPacket)
 
void handleCharterOffer (WorldPacket &recvPacket)
 
void handleCharterSign (WorldPacket &recvPacket)
 
void handleCharterDecline (WorldPacket &recvPacket)
 
void handleCharterRename (WorldPacket &recvPacket)
 
void handleCharterTurnInCharter (WorldPacket &recvPacket)
 
void handleCharterQuery (WorldPacket &recvPacket)
 
void handleCharterBuy (WorldPacket &recvPacket)
 
void handleGuildAssignRankOpcode (WorldPacket &recvPacket)
 
void handleGuildQueryRanksOpcode (WorldPacket &recvPacket)
 
void handleGuildRequestChallengeUpdate (WorldPacket &)
 
void handleGuildQueryXPOpcode (WorldPacket &recvPacket)
 
void handleGuildRequestPartyState (WorldPacket &recvPacket)
 
void handleGuildRequestMaxDailyXP (WorldPacket &recvPacket)
 
void handleAutoDeclineGuildInvites (WorldPacket &recvPacket)
 
void handleGuildRewardsQueryOpcode (WorldPacket &recvPacket)
 
void handleGuildQueryNewsOpcode (WorldPacket &recvPacket)
 
void handleGuildNewsUpdateStickyOpcode (WorldPacket &recvPacket)
 
void handleGuildSetGuildMaster (WorldPacket &recvPacket)
 
void handleGuildFinderAddRecruit (WorldPacket &recvPacket)
 
void handleGuildFinderBrowse (WorldPacket &recvPacket)
 
void handleGuildFinderDeclineRecruit (WorldPacket &recvPacket)
 
void handleGuildFinderGetApplications (WorldPacket &)
 
void handleGuildFinderGetRecruits (WorldPacket &recvPacket)
 
void handleGuildFinderPostRequest (WorldPacket &)
 
void handleGuildFinderRemoveRecruit (WorldPacket &recvPacket)
 
void handleGuildFinderSetGuildPost (WorldPacket &recvPacket)
 

Private Attributes

bool isAddonMessageFiltered
 
std::vector< std::string > mRegisteredAddonPrefixesVector
 
AddonsList m_addonList
 
Player_player
 
WorldSocket_socket
 
MovementInfo sessionMovementInfo
 
uint32_t _accountId
 
uint32_t _accountFlags
 
std::string _accountName
 
uint8_t _side
 
WoWGuid m_MoverWoWGuid
 
uint32_t _logoutTime
 
std::array< AccountDataEntry, 8 > sAccountData {}
 
ThreadSafeQueue< std::unique_ptr< WorldPacket > > _recvQueue
 
std::string permissions
 
bool _loggingOut
 
bool LoggingOut
 
uint32_t _latency
 
uint16_t client_build
 
uint32_t instanceId
 
uint8_t _updatecount
 

Friends

class WorldSocket
 
class Player
 

Detailed Description

Definition at line 92 of file WorldSession.h.

Member Typedef Documentation

◆ AddonsList

typedef std::list<AddonEntry> WorldSession::AddonsList
private

Definition at line 696 of file WorldSession.h.

Constructor & Destructor Documentation

◆ WorldSession()

WorldSession::WorldSession ( uint32_t  id,
std::string  name,
WorldSocket sock 
)

Definition at line 54 of file WorldSession.cpp.

54 :
55 m_loggingInPlayer(nullptr),
57 m_lastPing(0),
58 bDeleted(false),
61 m_wLevel(0),
62 m_bIsWLevelSet(false),
63 _player(nullptr),
64 _socket(sock),
65 _accountId(id),
67 _accountName(name),
68#if VERSION_STRING > TBC
69 has_level_55_char(false),
70 has_dk(false),
71#endif
72 _side(255),
73 _logoutTime(0),
74 _loggingOut(false),
75 LoggingOut(false),
76 _latency(0),
77 client_build(0),
78 instanceId(0),
79 _updatecount(0),
80 floodLines(0),
82 language(0),
83 m_muted(0),
85{
86#if VERSION_STRING >= Cata
88#endif
89
90 for (uint8_t x = 0; x < 8; x++)
91 sAccountData[x].data = nullptr;
92}
SERVER_DECL time_t UNIXTIME
Definition Log.cpp:17
Player * m_loggingInPlayer
uint32_t _logoutTime
uint32_t _accountId
uint16_t client_build
uint32_t floodLines
bool isAddonMessageFiltered
uint32_t m_currMsTime
std::string _accountName
int32_t m_moveDelayTime
uint32_t m_lastPing
uint32_t instanceId
Player * _player
uint32_t _latency
uint32_t _accountFlags
int32_t m_clientTimeDelay
uint32_t m_loginTime
WorldSocket * _socket
uint32_t language
uint8_t _updatecount
uint32_t m_muted
std::array< AccountDataEntry, 8 > sAccountData
uint32_t getMSTime()
Definition Util.cpp:143

◆ ~WorldSession()

WorldSession::~WorldSession ( )

Definition at line 94 of file WorldSession.cpp.

95{
96 std::lock_guard guard(deleteMutex);
97
98 if (_player)
99 {
100 sLogger.failure("warning: logged out player in worldsession destructor");
101 LogoutPlayer(true);
102 }
103
104 while (auto packet = _recvQueue.pop())
105 {
106 }
107
108 if (_socket)
109 _socket->SetSession(nullptr);
110
113}
#define sLogger
Definition Logger.hpp:136
void setSession(WorldSession *session)
Definition Player.cpp:3132
std::optional< T > pop()
std::mutex deleteMutex
void LogoutPlayer(bool Save)
ThreadSafeQueue< std::unique_ptr< WorldPacket > > _recvQueue
void SetSession(WorldSession *session)
Definition WorldSocket.h:95
Here is the call graph for this function:

Member Function Documentation

◆ buildQuestQueryResponse()

std::unique_ptr< WorldPacket > WorldSession::buildQuestQueryResponse ( QuestProperties const *  qst)

Definition at line 198 of file QuestHandler.cpp.

199{
200 auto data = std::make_unique<WorldPacket>(SMSG_QUEST_QUERY_RESPONSE, 100);
201 MySQLStructure::LocalesQuest const* lci = (language > 0) ? sMySQLStore.getLocalizedQuest(qst->id, language) : nullptr;
202
203 *data << uint32_t(qst->id); // Quest ID
204 *data << uint32_t(2); // Unknown, always seems to be 2
205 *data << int32_t(qst->questlevel); // Quest level
206 *data << uint32_t(qst->min_level); // Quest required level
207
208 if (qst->quest_sort > 0)
209 *data << int32_t(-(int32_t)qst->quest_sort); // Negative if pointing to a sort.
210 else
211 *data << uint32_t(qst->zone_id); // Positive if pointing to a zone.
212
213 *data << uint32_t(qst->type); // Info ID / Type
214 *data << qst->suggestedplayers; // suggested players
215
216 *data << uint32_t(qst->required_rep_faction); // Faction ID
217 *data << uint32_t(qst->required_rep_value); // Faction Amount
218
219 *data << uint32_t(0); // Unknown (always 0)
220 *data << uint32_t(0); // Unknown (always 0)
221
222 *data << uint32_t(qst->next_quest_id); // Next Quest ID
223 *data << uint32_t(0); // Column id +1 from QuestXp.dbc, entry is quest level
224
225 *data << uint32_t(sQuestMgr.GenerateRewardMoney(_player, qst)); // Copper reward
226 *data << uint32_t(qst->reward_money < 0 ? -qst->reward_money : 0); // Required Money
227
228 *data << uint32_t(qst->reward_spell); // Spell added to spellbook upon completion
229 *data << int32_t(qst->effect_on_player); // Spell casted on player upon completion
230
231 *data << uint32_t(qst->bonushonor);
232 *data << float(0); // 3.3.0 - some multiplier for honor
233 *data << uint32_t(qst->srcitem); // Item given at the start of a quest (srcitem)
234 *data << uint32_t(qst->quest_flags); // Quest Flags
235 *data << uint32_t(0); // target minimap
236 *data << uint32_t(qst->rewardtitleid);
237 *data << uint32_t(0); // playerkillcount
238 *data << uint32_t(qst->rewardtalents);
239 *data << uint32_t(0); // arena points
240 *data << uint32_t(0); // reward skill id
241 *data << uint32_t(0); // reward skill points
242 *data << uint32_t(0); // rep mask (unsure on what it does)
243 *data << uint32_t(0); // quest giver entry ?
244 *data << uint32_t(0); // quest turnin entry ?
245
246 if (qst->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
247 {
248 for (uint8_t i = 0; i < 4; ++i)
249 {
250 *data << uint32_t(0);
251 *data << uint32_t(0);
252 }
253
254 for (uint8_t i = 0; i < 6; ++i)
255 {
256 *data << uint32_t(0);
257 *data << uint32_t(0);
258 }
259 }
260 else
261 {
262 for (uint8_t i = 0; i < 4; ++i)
263 {
264 *data << uint32_t(qst->reward_item[i]);
265 *data << uint32_t(qst->reward_itemcount[i]);
266 }
267 for (uint8_t i = 0; i < 6; ++i)
268 {
269 *data << uint32_t(qst->reward_choiceitem[i]);
270 *data << uint32_t(qst->reward_choiceitemcount[i]);
271 }
272 }
273
274 for (uint8_t i = 0; i < 5; ++i)
275 *data << uint32_t(qst->reward_repfaction[i]);
276
277 for (uint8_t i = 0; i < 5; ++i)
278 *data << uint32_t(0); // column index in QuestFactionReward.dbc but use unknown
279
280 for (uint8_t i = 0; i < 5; ++i)
281 *data << uint32_t(0); // unk
282
283 *data << qst->point_mapid;
284 *data << qst->point_x;
285 *data << qst->point_y;
286 *data << qst->point_opt;
287
288 *data << (lci ? lci->title : qst->title);
289 *data << (lci ? lci->objectives : qst->objectives);
290 *data << (lci ? lci->details : qst->details);
291 *data << (lci ? lci->endText : qst->endtext);
292 *data << ""; // completed text
293
294 for (uint8_t i = 0; i < 4; ++i)
295 {
296 *data << uint32_t(qst->required_mob_or_go[i]); // Kill mob entry ID [i]
297 *data << uint32_t(qst->required_mob_or_go_count[i]); // Kill mob count [i]
298 *data << uint32_t(0); // req src item
299 *data << uint32_t(0); // req src item count
300 }
301
302 for (uint8_t i = 0; i < MAX_REQUIRED_QUEST_ITEM; ++i)
303 {
304 *data << uint32_t(qst->required_item[i]); // Collect item [i]
305 *data << uint32_t(qst->required_itemcount[i]); // Collect item count [i]
306 }
307
308 for (uint8_t i = 0; i < 4; ++i)
309 *data << (lci ? lci->objectiveText[i] : qst->objectivetexts[i]);
310
311 for (uint8_t i = 0; i < 4; ++i)
312 {
313 *data << uint32_t(0); // currency id
314 *data << uint32_t(0); // currency count
315 }
316
317 for (uint8_t i = 0; i < 4; ++i)
318 {
319 *data << uint32_t(0); // req currency id
320 *data << uint32_t(0); // req currency count
321 }
322
323 *data << ""; //questGiverTextWindow;
324 *data << ""; //questGiverTargetName;
325 *data << ""; //questTurnTextWindow;
326 *data << ""; //questTurnTargetName;
327 *data << uint32_t(0); // accept sound?
328 *data << uint32_t(0); // sound turn in?
329
330 return data;
331}
#define sMySQLStore
@ SMSG_QUEST_QUERY_RESPONSE
Definition Opcodes.hpp:129
@ QUEST_FLAGS_HIDDEN_REWARDS
Not used currently: DELIVER_MORE Quest needs more than normal _q-item drops from mobs.
#define sQuestMgr
Definition QuestMgr.h:252
#define MAX_REQUIRED_QUEST_ITEM
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CanUseCommand()

bool WorldSession::CanUseCommand ( char  cmdstr)

Definition at line 446 of file WorldSession.cpp.

447{
448 std::string commandPermission;
449 commandPermission.append(1, cmdstr);
450 return canUseCommand(commandPermission);
451}
bool canUseCommand(const std::string &cmdstr) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canUseCommand()

bool WorldSession::canUseCommand ( const std::string &  cmdstr) const

Definition at line 453 of file WorldSession.cpp.

454{
455 return hasPermission(cmdstr.c_str());
456}
bool hasPermission(const char *requiredPermission) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ characterEnumProc()

void WorldSession::characterEnumProc ( QueryResult result)

Definition at line 773 of file CharacterHandler.cpp.

774{
775 std::vector<CharEnumData> enumData;
776
777#if VERSION_STRING > TBC
778 has_dk = false;
779#endif
780 _side = 255;
781
782 uint8_t charRealCount = 0;
783
784 const auto startTime = Util::TimeNow();
785
786 if (result)
787 {
788 do
789 {
790 Field* fields = result->Fetch();
791
792 CharEnumData charEnum;
793
794 charEnum.guid = fields[0].asUint64();
795 charEnum.level = fields[1].asUint8();
796 charEnum.race = fields[2].asUint8();
797 charEnum.Class = fields[3].asUint8();
798
799 if (!isClassRaceCombinationPossible(charEnum.Class, charEnum.race))
800 {
801 sLogger.debug("Class {} and race {} is not a valid combination for Version {} - skipped",
802 charEnum.Class, charEnum.race, VERSION_STRING);
803 continue;
804 }
805
806 charEnum.gender = fields[4].asUint8();
807 charEnum.bytes = fields[5].asUint32();
808 charEnum.bytes2 = fields[6].asUint32();
809 charEnum.name = fields[7].asCString();
810 charEnum.x = fields[8].asFloat();
811 charEnum.y = fields[9].asFloat();
812 charEnum.z = fields[10].asFloat();
813 charEnum.mapId = fields[11].asUint32();
814 charEnum.zoneId = fields[12].asUint32();
815 charEnum.banned = fields[13].asUint32();
816
817 charEnum.deathState = fields[15].asUint32();
818 charEnum.loginFlags = fields[16].asUint32();
819 charEnum.flags = fields[17].asUint32();
820 charEnum.guildId = fields[18].asUint32();
821
822 if (_side == 255)
823 _side = getSideByRace(charEnum.race);
824
825#if VERSION_STRING >= WotLK
826 has_level_55_char = has_level_55_char || (charEnum.level >= 55);
827 has_dk = has_dk || (charEnum.Class == DEATHKNIGHT);
828#endif
829
830 charEnum.char_flags = 0;
831
832 if (charEnum.banned && (charEnum.banned < 10 || charEnum.banned >static_cast<uint32_t>(UNIXTIME)))
834 if (charEnum.deathState != 0)
836 if (charEnum.flags & PLAYER_FLAG_NOHELM)
838 if (charEnum.flags & PLAYER_FLAG_NOCLOAK)
840 if (charEnum.loginFlags == 1)
842
843#if VERSION_STRING >= WotLK
844 switch (charEnum.loginFlags)
845 {
848 break;
851 break;
854 break;
855 default:
857 }
858#endif
859
860 charEnum.pet_data.display_id = 0;
861 charEnum.pet_data.level = 0;
862 charEnum.pet_data.family = 0;
863
864 if (charEnum.Class == WARLOCK || charEnum.Class == HUNTER
865#if VERSION_STRING >= WotLK
866 || charEnum.Class == DEATHKNIGHT || charEnum.Class == MAGE
867#endif
868 )
869 {
870 auto player_pet_db_result = CharacterDatabase.Query("SELECT entry, model, level FROM playerpets WHERE ownerguid = %u "
871 "AND active = TRUE AND alive = TRUE LIMIT 1;", WoWGuid::getGuidLowPartFromUInt64(charEnum.guid));
872 if (player_pet_db_result)
873 {
874 if (const auto petInfo = sMySQLStore.getCreatureProperties(player_pet_db_result->Fetch()[0].asUint32()))
875 {
876 charEnum.pet_data.display_id = player_pet_db_result->Fetch()[1].asUint32();
877 charEnum.pet_data.level = player_pet_db_result->Fetch()[2].asUint32();
878 charEnum.pet_data.family = petInfo->Family;
879 }
880 }
881 }
882
883 auto item_db_result = CharacterDatabase.Query("SELECT slot, entry, enchantments FROM playeritems "
884 "WHERE ownerguid=%u AND containerslot = '-1' AND slot BETWEEN '0' AND '22'",
886
887 memset(charEnum.player_items, 0, sizeof(PlayerItem) * INVENTORY_SLOT_BAG_END);
888
889 if (item_db_result)
890 {
891 do
892 {
893 int8_t item_slot = item_db_result->Fetch()[0].asInt8();
894 const auto itemProperties = sMySQLStore.getItemProperties(item_db_result->Fetch()[1].asUint32());
895 if (itemProperties)
896 {
897 charEnum.player_items[item_slot].displayId = itemProperties->DisplayInfoID;
898 charEnum.player_items[item_slot].inventoryType = static_cast<uint8_t>(itemProperties->InventoryType);
899
900 std::string enchant_field = item_db_result->Fetch()[2].asCString();
901 if (!enchant_field.empty())
902 {
903 std::vector<std::string> enchants = AscEmu::Util::Strings::split(enchant_field, ";");
904 uint32_t enchant_id;
905 uint32_t enchslot;
906
907 for (auto& enchant : enchants)
908 {
909 if (sscanf(enchant.c_str(), "%u,0,%u", &enchant_id, &enchslot) == 2)
910 {
911#if VERSION_STRING == Cata
912 if (enchslot == TRANSMOGRIFY_ENCHANTMENT_SLOT)
913 {
914 const auto itemProperties = sMySQLStore.getItemProperties(enchant_id);
915 if (itemProperties)
916 charEnum.player_items[item_slot].displayId = itemProperties->DisplayInfoID;
917 }
918#endif
919 // Only Display Perm Enchants on Weapons
920 if ((item_slot == EQUIPMENT_SLOT_MAINHAND || item_slot == EQUIPMENT_SLOT_OFFHAND) && enchslot == PERM_ENCHANTMENT_SLOT)
921 {
922 const auto spellItemEnchantmentEntry = sSpellItemEnchantmentStore.lookupEntry(enchant_id);
923 if (spellItemEnchantmentEntry != nullptr)
924 charEnum.player_items[item_slot].enchantmentId = spellItemEnchantmentEntry->visual;
925 }
926 }
927 }
928 }
929 }
930 } while (item_db_result->NextRow());
931 }
932
933 // save data to serialize it in packet serialisation SmsgEnumCharactersResult.
934 enumData.push_back(charEnum);
935
936 ++charRealCount;
937 } while (result->NextRow());
938 }
939
940 sLogger.debug("Character Enum Built in {} ms.", static_cast<uint32_t>(Util::GetTimeDifferenceToNow(startTime)));
941 SendPacket(SmsgEnumCharactersResult(charRealCount, enumData).serialise().get());
942}
#define CharacterDatabase
@ EQUIPMENT_SLOT_MAINHAND
@ EQUIPMENT_SLOT_OFFHAND
@ INVENTORY_SLOT_BAG_END
@ PERM_ENCHANTMENT_SLOT
@ TRANSMOGRIFY_ENCHANTMENT_SLOT
@ LOGIN_CUSTOMIZE_RACE
@ LOGIN_CUSTOMIZE_LOOKS
@ LOGIN_CUSTOMIZE_FACTION
@ CHARACTER_SCREEN_FLAG_BANNED
@ CHARACTER_SCREEN_FLAG_DEAD
@ CHARACTER_SCREEN_FLAG_FORCED_RENAME
@ CHARACTER_SCREEN_FLAG_HIDE_CLOAK
@ CHARACTER_SCREEN_FLAG_HIDE_HELM
@ CHAR_CUSTOMIZE_FLAG_RACE
@ CHAR_CUSTOMIZE_FLAG_NONE
@ CHAR_CUSTOMIZE_FLAG_FACTION
@ CHAR_CUSTOMIZE_FLAG_CUSTOMIZE
@ PLAYER_FLAG_NOCLOAK
@ PLAYER_FLAG_NOHELM
static uint8_t getSideByRace(uint8_t race)
@ MAGE
@ HUNTER
@ DEATHKNIGHT
@ WARLOCK
bool isClassRaceCombinationPossible(uint8_t _class, uint8_t _race)
SERVER_DECL WDB::WDBContainer< WDB::Structures::SpellItemEnchantmentEntry > sSpellItemEnchantmentStore
uint8_t asUint8(bool _silencedError=false) const
Definition Field.cpp:18
uint64_t asUint64(bool _silencedError=false) const
Definition Field.cpp:27
const char * asCString() const
Definition Field.cpp:13
uint32_t asUint32(bool _silencedError=false) const
Definition Field.cpp:24
float asFloat() const
Definition Field.cpp:15
Field * Fetch()
Definition Database.h:195
virtual bool NextRow()=0
static uint32_t getGuidLowPartFromUInt64(uint64_t guid)
Definition WoWGuid.h:228
void SendPacket(WorldPacket *packet)
std::vector< std::string > split(const std::string &source, const std::string &seperator)
Seperates string by seperator (one char) returns string vecotr.
Definition Strings.cpp:39
long long GetTimeDifferenceToNow(const std::chrono::high_resolution_clock::time_point &start_time)
Returns the difference between start_time and now in milliseconds.
Definition Util.cpp:150
std::chrono::high_resolution_clock::time_point TimeNow()
Returns the current point in time.
Definition Util.cpp:130
uint32_t customization_flag
CharEnum_Pet pet_data
uint32_t char_flags
PlayerItem player_items[DBC_PLAYER_ITEMS]
std::string name
uint32_t loginFlags
uint32_t deathState
uint32_t display_id
uint32_t enchantmentId
uint8_t inventoryType
uint32_t displayId
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteCharacter()

uint8_t WorldSession::deleteCharacter ( WoWGuid  guid)

Definition at line 303 of file CharacterHandler.cpp.

304{
305 const auto playerInfo = sObjectMgr.getCachedCharacterInfo(guid.getGuidLow());
306 if (playerInfo != nullptr && sObjectMgr.getPlayer(playerInfo->guid) == nullptr)
307 {
308 auto result = CharacterDatabase.Query("SELECT name FROM characters WHERE guid = %u AND acct = %u", guid.getGuidLow(), _accountId);
309 if (!result)
311
312 std::string name = result->Fetch()[0].asCString();
313
314 if (playerInfo->m_guild)
315 {
316 const auto guild = sGuildMgr.getGuildById(playerInfo->m_guild);
317 if (guild != nullptr && guild->getLeaderGUID() == playerInfo->guid)
319
320 if (guild != nullptr)
321 guild->handleRemoveMember(this, playerInfo->guid);
322 }
323
324 for (uint8_t i = 0; i < NUM_CHARTER_TYPES; ++i)
325 {
326 if (const auto charter = sObjectMgr.getCharterByGuid(guid, static_cast<CharterTypes>(i)))
327 charter->removeSignature(guid.getGuidLow());
328 }
329
330
331 for (uint8_t i = 0; i < NUM_ARENA_TEAM_TYPES; ++i)
332 {
333 const auto arenaTeam = sObjectMgr.getArenaTeamByGuid(guid.getGuidLow(), i);
334 if (arenaTeam != nullptr && arenaTeam->m_leader == guid.getGuidLow())
336
337 if (arenaTeam != nullptr)
338 arenaTeam->removeMember(playerInfo);
339 }
340
341 sPlrLog.writefromsession(this, "deleted character %s %u (guidLow))", name.c_str(), guid.getGuidLow());
342
343 CharacterDatabase.WaitExecute("DELETE FROM characters WHERE guid = %u", guid.getGuidLow());
344
345 const auto corpse = sObjectMgr.getCorpseByOwner(guid.getGuidLow());
346 if (corpse)
347 CharacterDatabase.Execute("DELETE FROM corpses WHERE guid = %u", corpse->getGuidLow());
348
349 CharacterDatabase.Execute("DELETE FROM playeritems WHERE ownerguid=%u", guid.getGuidLow());
350 CharacterDatabase.Execute("DELETE FROM gm_tickets WHERE playerguid = %u", guid.getGuidLow());
351 CharacterDatabase.Execute("DELETE FROM playerpets WHERE ownerguid = %u", guid.getGuidLow());
352 CharacterDatabase.Execute("DELETE FROM playerpetspells WHERE ownerguid = %u", guid.getGuidLow());
353 CharacterDatabase.Execute("DELETE FROM tutorials WHERE playerId = %u", guid.getGuidLow());
354 CharacterDatabase.Execute("DELETE FROM questlog WHERE player_guid = %u", guid.getGuidLow());
355 CharacterDatabase.Execute("DELETE FROM playercooldowns WHERE player_guid = %u", guid.getGuidLow());
356 CharacterDatabase.Execute("DELETE FROM mailbox WHERE player_guid = %u", guid.getGuidLow());
357 CharacterDatabase.Execute("DELETE FROM social_friends WHERE character_guid = %u OR friend_guid = %u",
358 guid.getGuidLow(), guid.getGuidLow());
359 CharacterDatabase.Execute("DELETE FROM social_ignores WHERE character_guid = %u OR ignore_guid = %u",
360 guid.getGuidLow(), guid.getGuidLow());
361 CharacterDatabase.Execute("DELETE FROM character_achievement WHERE guid = %u AND achievement NOT IN "
362 "(457, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, "
363 "1413, 1415, 1414, 1416, 1417, 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1463, 1400, 456, 1402)",
364 guid.getGuidLow());
365 CharacterDatabase.Execute("DELETE FROM character_achievement_progress WHERE guid = %u", guid.getGuidLow());
366 CharacterDatabase.Execute("DELETE FROM playerspells WHERE GUID = %u", guid.getGuidLow());
367 CharacterDatabase.Execute("DELETE FROM playerdeletedspells WHERE GUID = %u", guid.getGuidLow());
368 CharacterDatabase.Execute("DELETE FROM playerreputations WHERE guid = %u", guid.getGuidLow());
369 CharacterDatabase.Execute("DELETE FROM playerskills WHERE GUID = %u", guid.getGuidLow());
370 CharacterDatabase.Execute("DELETE FROM playersummons WHERE ownerguid=%u", guid.getGuidLow());
371 CharacterDatabase.Execute("DELETE FROM playersummonspells WHERE ownerguid=%u", guid.getGuidLow());
372
373 sObjectMgr.deleteCachedCharacterInfo(guid.getGuidLow());
375 }
377}
@ E_CHAR_DELETE_FAILED_GUILD_LEADER
@ E_CHAR_DELETE_FAILED
@ E_CHAR_DELETE_FAILED_ARENA_CAPTAIN
@ E_CHAR_DELETE_SUCCESS
#define sGuildMgr
Definition GuildMgr.hpp:63
#define sObjectMgr
@ NUM_ARENA_TEAM_TYPES
CharterTypes
@ NUM_CHARTER_TYPES
#define sPlrLog
uint32_t getGuidLow() const
Definition WoWGuid.h:221
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Disconnect()

void WorldSession::Disconnect ( )

Definition at line 720 of file WorldSession.cpp.

721{
722 if (_socket && _socket->IsConnected())
723 {
725 }
726}
void Disconnect()
Definition Socket.cpp:116
bool IsConnected()
Definition Socket.h:87
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doLootRelease()

void WorldSession::doLootRelease ( WoWGuid  lguid)
protected

Definition at line 372 of file LootHandler.cpp.

373{
374 Player* player = GetPlayer();
375 Loot* loot = nullptr;
376
378
382
383 if (!player->IsInWorld())
384 return;
385
386 if (lguid.isGameObject())
387 {
389 if (auto gameObjectLootable = dynamic_cast<GameObject_Lootable*>(go))
390 {
391 // Remove our Guid
392 gameObjectLootable->loot.removeLooter(_player->getGuidLow());
393
394 // Remove roundrobin and make Lootable for evryone in our group
395 gameObjectLootable->loot.roundRobinPlayer = 0;
396 // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
397 if (!go || ((go->getCreatedByGuid() != _player->getGuid() && go->getGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player, 30.0f)))
398 return;
399
400 loot = &gameObjectLootable->loot;
401
402 if (go->getGoType() == GAMEOBJECT_TYPE_DOOR)
403 {
404 // locked doors are opened with spelleffect openlock, prevent remove its as looted
405 go->useDoorOrButton();
406 }
407 else if (loot->isLooted() || go->getGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
408 {
410 { // The fishing hole used once more
411 go->addUse(); // if the max usage is reached, will be despawned in next tick
412 if (go->getUseCount() >= dynamic_cast<GameObject_FishingHole*>(go)->getMaxOpen())
414 else
416 }
417 else
418 {
420 }
421
422 loot->clear();
423 }
424 else
425 {
426 // not fully looted object
427 go->setLootState(GO_ACTIVATED, player);
428
429 // if the round robin player release, reset it.
430 if (player->getGuid() == loot->roundRobinPlayer)
431 loot->roundRobinPlayer = 0;
432 }
433 }
434 }
435 else if (lguid.isCorpse()) // ONLY remove insignia at BG
436 {
437 auto* corpse = sObjectMgr.getCorpseByGuid(lguid.getGuidLow());
438 if (!corpse || !corpse->IsWithinDistInMap(_player, 5.0f))
439 return;
440
441 loot = &corpse->loot;
442
443 if (loot->isLooted())
444 {
445 loot->clear();
446 corpse->setDynamicFlags(0);
447 }
448 }
449 else if (lguid.isItem())
450 {
451 if (auto item = _player->getItemInterface()->GetItemByGUID(lguid.getRawGuid()))
452 {
453 if (item->m_loot != nullptr)
454 {
455 if (item->m_loot->isLooted())
456 {
457 item->m_loot = nullptr;
458 }
459 }
460
461 if (item->m_loot == nullptr)
463 }
464 return; // item can be looted only single player
465 }
466 else if (lguid.isPlayer())
467 {
468 if (auto lootablePlayer = sObjectMgr.getPlayer(lguid.getGuidLow()))
469 {
470 lootablePlayer->m_lootableOnCorpse = false;
471 lootablePlayer->loot.items.clear();
472 lootablePlayer->removeDynamicFlags(U_DYN_FLAG_LOOTABLE);
473 }
474 }
475 else
476 {
477 if (Creature* creature = GetPlayer()->getWorldMap()->getCreature(lguid.getGuidLowPart()))
478 {
479 // Remove roundrobin and make Lootable for evryone in our group
480 creature->loot.roundRobinPlayer = 0;
481
482 loot = &creature->loot;
483 if (creature->loot.isLooted())
484 {
485 // Make creature no Longer Lootable we have no more loot left
486 for (auto players : creature->getInRangePlayersSet())
487 {
488 Player* plr = players->ToPlayer();
489 if (creature->isTaggedByPlayerOrItsGroup(plr))
490 {
491#if VERSION_STRING < Mop
492 creature->BuildFieldUpdatePacket(plr, getOffsetForStructuredField(WoWUnit, dynamic_flags), 0);
493#else
494 creature->BuildFieldUpdatePacket(plr, getOffsetForStructuredField(WoWObject, dynamic_field), 0);
495#endif
496 }
497 }
498
499 // Make our Creature Skinnable when possible
500 if (!creature->Skinned && sLootMgr.isSkinnable(creature->getEntry()))
501 creature->BuildFieldUpdatePacket(_player, getOffsetForStructuredField(WoWUnit, unit_flags), UNIT_FLAG_SKINNABLE);
502 }
503 else
504 {
505 // When Loot is left make Lootable for our mates
506 // Send Loot Update to our GroupMembers
507 for (auto players : _player->getInRangePlayersSet())
508 {
509 Player* plr = players->ToPlayer();
510 if (creature->isTaggedByPlayerOrItsGroup(plr))
511 {
512 plr->sendLootUpdate(creature);
513 }
514 }
515 }
516 }
517 }
518
519 //Player is not looking at loot list, he doesn't need to see updates on the loot list
520 if (loot)
522}
@ GO_ACTIVATED
@ GO_JUST_DEACTIVATED
@ GAMEOBJECT_TYPE_FISHINGHOLE
@ GAMEOBJECT_TYPE_FISHINGNODE
@ GAMEOBJECT_TYPE_DOOR
#define sLootMgr
Definition LootMgr.hpp:106
@ UNIT_FLAG_LOOTING
@ UNIT_FLAG_SKINNABLE
@ U_DYN_FLAG_LOOTABLE
#define getOffsetForStructuredField(s, m)
virtual std::unique_ptr< WorldPacket > serialise()
uint32_t getMaxOpen() const
Definition GameObject.h:693
uint64_t getCreatedByGuid() const
uint8_t getGoType() const
void setLootState(LootState state, Unit *unit=nullptr)
void addUse()
Definition GameObject.h:91
void useDoorOrButton(uint32_t time_to_restore=0, bool alternative=false, Unit *user=nullptr)
uint32_t getUseCount() const
Definition GameObject.h:92
Item * GetItemByGUID(uint64_t itemGuid)
Gets a Item by guid.
uint32_t RemoveItemAmtByGuid(uint64_t guid, uint32_t amt)
Removes desired amount of items by guid.
void BuildFieldUpdatePacket(Player *Target, uint32_t Index, uint32_t Value)
Definition Object.cpp:1782
uint64_t getGuid() const
Definition Object.cpp:295
Player * ToPlayer()
Definition Object.hpp:391
bool IsInWorld() const
Definition Object.hpp:98
bool IsWithinDistInMap(Object *obj, const float dist2compare) const
Definition Object.cpp:3592
WorldMap * getWorldMap() const
Definition Object.hpp:454
uint32_t getGuidLow() const
Definition Object.cpp:304
ItemInterface * getItemInterface() const
Definition Player.cpp:6934
uint64_t m_currentLoot
Definition Player.hpp:1649
void sendLootUpdate(Object *object)
Definition Player.cpp:11129
void setLootGuid(const uint64_t &guid)
Definition Player.cpp:10788
void removeUnitFlags(uint32_t unitFlags)
Definition Unit.cpp:1110
bool isItem() const
Definition WoWGuid.h:292
bool isGameObject() const
Definition WoWGuid.h:297
bool isCorpse() const
Definition WoWGuid.h:291
bool isPlayer() const
Definition WoWGuid.h:290
uint32_t getGuidLowPart() const
Definition WoWGuid.h:222
uint64_t getRawGuid() const
Definition WoWGuid.h:261
GameObject * getGameObject(uint32_t guid)
Player * GetPlayer()
Definition Loot.hpp:35
void removeLooter(uint32_t GUID)
Definition Loot.hpp:71
bool isLooted() const
Definition Loot.hpp:65
void clear()
Definition Loot.cpp:125
uint64_t roundRobinPlayer
Definition Loot.hpp:44
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fullLogin()

void WorldSession::fullLogin ( Player player)

Definition at line 595 of file CharacterHandler.cpp.

596{
597 sLogger.debug("WorldSession : Fully loading player {}", player->getGuidLow());
598
599 //////////////////////////////////////////////////////////////////////////////////////////
600 // basic setup
601 SetPlayer(player);
602 m_MoverWoWGuid.Init(player->getGuid());
603
604 //////////////////////////////////////////////////////////////////////////////////////////
605
606 //////////////////////////////////////////////////////////////////////////////////////////
607 // maybe you logged out inside a bg
608 player->logIntoBattleground();
609 //////////////////////////////////////////////////////////////////////////////////////////
610
611 //////////////////////////////////////////////////////////////////////////////////////////
612 // start on GM Island or normal position for first login. Check out the config.
613 player->setLoginPosition();
614 //////////////////////////////////////////////////////////////////////////////////////////
615
616#if VERSION_STRING > TBC
617 //////////////////////////////////////////////////////////////////////////////////////////
618 // send feature packet... mostly unknown content.
619 SendPacket(SmsgFeatureSystemStatus(2, 0).serialise().get());
620 //////////////////////////////////////////////////////////////////////////////////////////
621
622 //////////////////////////////////////////////////////////////////////////////////////////
623 // dance moves - unknown 2x uint32_t(0)
624#if VERSION_STRING != Mop
625 SendPacket(SmsgLearnedDanceMoves(0, 0).serialise().get());
626#endif
627 //////////////////////////////////////////////////////////////////////////////////////////
628#endif
629
630 //////////////////////////////////////////////////////////////////////////////////////////
631 // hotfix data for cata
632#if VERSION_STRING >= Cata
633 //\todo send Hotfixdata
634#endif
635 //////////////////////////////////////////////////////////////////////////////////////////
636
637 //////////////////////////////////////////////////////////////////////////////////////////
638 // update/set attack speed - mostly 0 on login
639 player->updateAttackSpeed();
640 //////////////////////////////////////////////////////////////////////////////////////////
641
642 //////////////////////////////////////////////////////////////////////////////////////////
643 // set playerinfo - should be already set, just in case.
644 player->setPlayerInfoIfNeeded();
645 //////////////////////////////////////////////////////////////////////////////////////////
646
647 //////////////////////////////////////////////////////////////////////////////////////////
648 // account data times - since we just logged in, it is 0
650 //////////////////////////////////////////////////////////////////////////////////////////
651
652 //////////////////////////////////////////////////////////////////////////////////////////
653 // if we are on a transport we need a lot more checks, otherwise the mapmgr complains
654 const bool canEnterWorld = player->logOntoTransport();
655 //////////////////////////////////////////////////////////////////////////////////////////
656
657 //////////////////////////////////////////////////////////////////////////////////////////
658 // set db, time and count - our db now knows that we are online.
659 CharacterDatabase.Execute("UPDATE characters SET online = 1 WHERE guid = %u", player->getGuidLow());
660 sLogger.debug("Player {} logged in.", player->getName());
661 sWorld.incrementPlayerCount(player->getTeam());
662
663 player->m_playedTime[2] = uint32_t(UNIXTIME);
664 //////////////////////////////////////////////////////////////////////////////////////////
665
666 //////////////////////////////////////////////////////////////////////////////////////////
667 // send cinematic on first login if we still allow it in the config
669 //////////////////////////////////////////////////////////////////////////////////////////
670
671 //////////////////////////////////////////////////////////////////////////////////////////
672 // send social packets and lists
673 player->sendFriendStatus(true);
674 player->sendFriendLists(7);
675
676 //////////////////////////////////////////////////////////////////////////////////////////
677 // dungeon and raid setup
678#if VERSION_STRING > TBC
680 player->sendRaidDifficultyPacket();
681#endif
682 //////////////////////////////////////////////////////////////////////////////////////////
683
684 //////////////////////////////////////////////////////////////////////////////////////////
685 // Send Equipment set list - not sure what the intend was here.
686#if VERSION_STRING < Cata
687 player->sendEquipmentSetList();
688#endif
689 //////////////////////////////////////////////////////////////////////////////////////////
690
691 //////////////////////////////////////////////////////////////////////////////////////////
692 // GMMyMaster is a custom addon, we send special chat messages to trigger it.
693 // send serverstats (uptime, playerpeak,..)
694 // server Message of the day from config (Welcome to the world of warcraft)
695
697
698 sendMOTD();
699
701
702#if VERSION_STRING == Mop
703 std::string timeZone = "Etc/UTC";
704
705 WorldPacket data(SMSG_SET_TIME_ZONE_INFORMATION, 2 + timeZone.length() * 2);
706 data.writeBits(timeZone.length(), 7);
707 data.writeBits(timeZone.length(), 7);
708 data.flushBits();
709 data.WriteString(timeZone);
710 data.WriteString(timeZone);
711 SendPacket(&data);
712
713 data.Initialize(SMSG_HOTFIX_NOTIFY_BLOB);
714 data.writeBits(0, 20);
715 data.flushBits();
716 SendPacket(&data);
717#endif
718
719 //////////////////////////////////////////////////////////////////////////////////////////
720
721 //////////////////////////////////////////////////////////////////////////////////////////
722 // the restxp is calculated with our offline time
723 if (player->m_isResting)
724 player->applyPlayerRestState(true);
725
726 if (player->m_timeLogoff > 0 && player->getLevel() < player->getMaxLevel())
727 {
728 const uint32_t currenttime = uint32_t(UNIXTIME);
729 const uint32_t timediff = currenttime - player->m_timeLogoff;
730
731 if (timediff > 0)
732 player->addCalculatedRestXp(timediff);
733 }
734 //////////////////////////////////////////////////////////////////////////////////////////
735
736 //////////////////////////////////////////////////////////////////////////////////////////
737
738 // Make sure CompleteLoading is always called
739 // Without this if player is entering to a faulty map it would not be ever called
740 player->setEnteringToWorld();
741
742 // add us to the world if we are not already added
743 if (canEnterWorld && !player->getWorldMap())
744 player->AddToWorld();
745 //////////////////////////////////////////////////////////////////////////////////////////
746
747#if VERSION_STRING == Mop
748 {
750 packet.writeBits(0, 21);
751 packet.flushBits();
752 player->sendPacket(&packet);
753 }
754#endif
755
756 sHookInterface.OnFullLogin(player);
757
758 sObjectMgr.addPlayer(player);
759}
#define sHookInterface
@ SMSG_SETUP_CURRENCY
Definition Opcodes.hpp:1660
@ SMSG_HOTFIX_NOTIFY_BLOB
Definition Opcodes.hpp:1658
@ SMSG_SET_TIME_ZONE_INFORMATION
Definition Opcodes.hpp:1769
const uint8_t PER_CHARACTER_CACHE_MASK
#define sWorld
Definition World.h:244
void sendRaidDifficultyPacket()
Definition Player.cpp:9577
void sendPacket(WorldPacket *packet) override
Definition Player.cpp:3161
void setEnteringToWorld()
Definition Player.cpp:3552
void sendEquipmentSetList()
Definition Player.cpp:9748
void sendFriendStatus(bool comesOnline)
Definition Player.cpp:9222
void addCalculatedRestXp(uint32_t seconds)
Definition Player.cpp:12224
void setPlayerInfoIfNeeded()
Definition Player.cpp:9492
utf8_string getName() const
Definition Player.cpp:2639
void updateAttackSpeed()
Definition Player.cpp:15504
uint32_t m_timeLogoff
Definition Player.hpp:745
void sendFriendLists(uint32_t flags)
Definition Player.cpp:9243
PlayerTeam getTeam() const
Definition Player.cpp:2774
void setLoginPosition()
Definition Player.cpp:9461
void applyPlayerRestState(bool apply)
Definition Player.cpp:12245
uint8_t m_isResting
Definition Player.hpp:1749
void logIntoBattleground()
Definition Player.cpp:9402
uint32_t m_playedTime[3]
Definition Player.hpp:743
bool logOntoTransport()
Definition Player.cpp:9424
void AddToWorld()
Definition Player.cpp:473
void sendDungeonDifficultyPacket()
Definition Player.cpp:9572
uint32_t getMaxLevel() const
Definition Player.cpp:1149
void sendCinematicOnFirstLogin()
Definition Player.cpp:9536
uint32_t getLevel() const
Definition Unit.cpp:936
void Init(uint64_t guid)
Definition WoWGuid.h:176
void SetPlayer(Player *plr)
WoWGuid m_MoverWoWGuid
void sendAccountDataTimes(uint32_t mask)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAccountData()

AccountDataEntry * WorldSession::GetAccountData ( uint32_t  index)

Definition at line 458 of file WorldSession.cpp.

459{
460 if (index < 8)
461 {
462 return &sAccountData[index];
463 }
464
465 sLogger.failure("GetAccountData tried to get invalid index {}", index);
466 return nullptr;
467}
Here is the caller graph for this function:

◆ GetAccountId()

uint32_t WorldSession::GetAccountId ( ) const
inline

Definition at line 112 of file WorldSession.h.

112{ return _accountId; }
Here is the caller graph for this function:

◆ GetAccountName()

std::string WorldSession::GetAccountName ( )
inline

Definition at line 204 of file WorldSession.h.

204{ return _accountName; }
Here is the caller graph for this function:

◆ GetAccountNameS()

const char * WorldSession::GetAccountNameS ( ) const
inline

Definition at line 205 of file WorldSession.h.

205{ return _accountName.c_str(); }
Here is the caller graph for this function:

◆ GetClientBuild()

uint16_t WorldSession::GetClientBuild ( )
inline

Definition at line 215 of file WorldSession.h.

215{ return client_build; }
Here is the caller graph for this function:

◆ GetFlags()

uint32_t WorldSession::GetFlags ( )
inline

Definition at line 143 of file WorldSession.h.

143{ return _accountFlags; }
Here is the caller graph for this function:

◆ GetInstance()

uint32_t WorldSession::GetInstance ( )
inline

Definition at line 220 of file WorldSession.h.

220{ return instanceId; }
Here is the caller graph for this function:

◆ getItemLootFromHighGuidType()

Loot * WorldSession::getItemLootFromHighGuidType ( WoWGuid  wowGuid)

Definition at line 36 of file LootHandler.cpp.

37{
38 switch(wowGuid.getHigh())
39 {
40 case HighGuid::Unit:
41 {
42 if (auto creature = _player->getWorldMap()->getCreature(wowGuid.getGuidLowPart()))
43 return &creature->loot;
44
45 return nullptr;
46 }
48 {
49 if (auto gameObject = _player->getWorldMap()->getGameObject(wowGuid.getGuidLowPart()))
50 {
51 if (gameObject->IsLootable())
52 return &dynamic_cast<GameObject_Lootable*>(gameObject)->loot;
53 }
54
55 return nullptr;
56 }
57 case HighGuid::Item:
58 {
59 if (const auto item = _player->getItemInterface()->GetItemByGUID(wowGuid.getRawGuid()))
60 return item->m_loot.get();
61
62 return nullptr;
63 }
65 {
66 if (auto player = _player->getWorldMap()->getPlayer(wowGuid.getGuidLowPart()))
67 return &player->loot;
68
69 return nullptr;
70 }
71 default:
72 {
73 return nullptr;
74 }
75 }
76}
HighGuid getHigh() const
Definition WoWGuid.h:247
Creature * getCreature(uint32_t guid)
Player * getPlayer(uint32_t guid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLatency()

uint32_t WorldSession::GetLatency ( ) const
inline

Definition at line 203 of file WorldSession.h.

203{ return _latency; }
Here is the caller graph for this function:

◆ getMoneyLootFromHighGuidType()

Loot * WorldSession::getMoneyLootFromHighGuidType ( WoWGuid  wowGuid)

Definition at line 157 of file LootHandler.cpp.

158{
159 switch (wowGuid.getHigh())
160 {
161 case HighGuid::Unit:
162 {
163 if (auto creature = _player->getWorldMap()->getCreature(wowGuid.getGuidLowPart()))
164 return &creature->loot;
165
166 return nullptr;
167 }
169 {
170 if (auto gameObject = _player->getWorldMap()->getGameObject(wowGuid.getGuidLowPart()))
171 {
172 if (gameObject->IsLootable())
173 return &dynamic_cast<GameObject_Lootable*>(gameObject)->loot;
174 }
175
176 return nullptr;
177 }
178 case HighGuid::Item:
179 {
180 if (const auto item = _player->getItemInterface()->GetItemByGUID(wowGuid.getRawGuid()))
181 return item->m_loot.get();
182
183 return nullptr;
184 }
185 case HighGuid::Player:
186 {
187 if (auto player = _player->getWorldMap()->getPlayer(wowGuid.getGuidLowPart()))
188 return &player->loot;
189
190 return nullptr;
191 }
192 case HighGuid::Corpse:
193 {
194 if (auto corpse = sObjectMgr.getCorpseByGuid(wowGuid.getGuidLowPart()))
195 return &corpse->loot;
196
197 return nullptr;
198 }
199 default:
200 {
201 return nullptr;
202 }
203 }
204}
Here is the call graph for this function:

◆ GetPermissions()

std::unique_ptr< char[]> WorldSession::GetPermissions ( ) const

Definition at line 417 of file WorldSession.cpp.

418{
419 auto charPtr = std::make_unique<char[]>(permissions.size() + 1);
420 std::strcpy(charPtr.get(), permissions.c_str());
421 return charPtr;
422}
std::string permissions
Here is the caller graph for this function:

◆ GetPlayer()

Player * WorldSession::GetPlayer ( )
inline

Definition at line 113 of file WorldSession.h.

113{ return _player; }

◆ GetPlayerOrThrow()

Player * WorldSession::GetPlayerOrThrow ( )

Definition at line 401 of file WorldSession.cpp.

402{
403 Player* player = this->_player;
404 if (player == nullptr)
406
407 return player;
408}
Here is the caller graph for this function:

◆ GetSocket()

WorldSocket * WorldSession::GetSocket ( )
inline

Definition at line 194 of file WorldSession.h.

194{ return _socket; }
Here is the caller graph for this function:

◆ handleAcceptTrade()

void WorldSession::handleAcceptTrade ( WorldPacket )
protected

Definition at line 199 of file TradeHandler.cpp.

200{
201 const auto tradeData = _player->getTradeData();
202 if (tradeData == nullptr)
203 return;
204
205 const auto tradeTarget = tradeData->getTradeTarget();
206 if (tradeTarget == nullptr)
207 return;
208
209 const auto targetTradeData = tradeTarget->getTradeData();
210 if (targetTradeData == nullptr)
211 return;
212
213 tradeData->setTradeAccepted(true);
214
215 if (tradeData->getTradeMoney() > _player->getCoinage())
216 {
217 tradeData->setTradeAccepted(false, true);
218 return;
219 }
220
221 if (targetTradeData->getTradeMoney() > tradeTarget->getCoinage())
222 {
223 targetTradeData->setTradeAccepted(false, true);
224 return;
225 }
226
227 if (targetTradeData->getTradeMoney() > 0)
228 {
229 // Check for gold cap
230 if (worldConfig.player.isGoldCapEnabled && ((_player->getCoinage() + targetTradeData->getTradeMoney()) > worldConfig.player.limitGoldAmount))
231 {
233 tradeData->setTradeAccepted(false, true);
234 return;
235 }
236 }
237
238 if (tradeData->getTradeMoney() > 0)
239 {
240 // Check for gold cap
241 if (worldConfig.player.isGoldCapEnabled && (tradeTarget->getCoinage() + tradeData->getTradeMoney()) > worldConfig.player.limitGoldAmount)
242 {
243 tradeTarget->getItemInterface()->buildInventoryChangeError(nullptr, nullptr, INV_ERR_TOO_MUCH_GOLD);
244 targetTradeData->setTradeAccepted(false, true);
245 return;
246 }
247 }
248
249 uint32_t itemCount = 0, targetItemCount = 0;
250 for (uint8_t i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
251 {
252 Item* tradeItem = tradeData->getTradeItem(TradeSlots(i));
253 if (tradeItem != nullptr)
254 {
255 if (tradeItem->isContainer())
256 {
257 const auto container = dynamic_cast<Container*>(tradeItem);
258 if (container != nullptr && container->hasItems())
259 {
260 _player->cancelTrade(true);
261 return;
262 }
263 }
264
265 if (!tradeItem->isTradeableWith(tradeTarget))
266 {
267 _player->cancelTrade(true);
268 return;
269 }
270 ++itemCount;
271 }
272
273 tradeItem = targetTradeData->getTradeItem(TradeSlots(i));
274 if (tradeItem != nullptr)
275 {
276 if (tradeItem->isContainer())
277 {
278 const auto container = dynamic_cast<Container*>(tradeItem);
279 if (container != nullptr && container->hasItems())
280 {
281 tradeTarget->cancelTrade(true);
282 return;
283 }
284 }
285
286 if (!tradeItem->isTradeableWith(tradeTarget))
287 {
288 tradeTarget->cancelTrade(true);
289 return;
290 }
291 ++targetItemCount;
292 }
293 }
294
295 // Check if player has enough free slots
296 if ((_player->getItemInterface()->CalculateFreeSlots(nullptr) + itemCount) < targetItemCount)
297 {
299 tradeData->setTradeAccepted(false, true);
300 return;
301 }
302
303 // If trade target has not accepted, do not proceed
304 if (!targetTradeData->isTradeAccepted())
305 {
306 tradeTarget->getSession()->sendTradeResult(TRADE_STATUS_ACCEPTED);
307 return;
308 }
309
310 // Both parties have accepted, proceed
311 tradeTarget->getSession()->sendTradeResult(TRADE_STATUS_ACCEPTED);
312
313 // Check player's spell on the lowest item
314 Spell* playerSpell = nullptr;
315 SpellCastTargets playerSpellTargets;
316 if (tradeData->getSpell() != 0)
317 {
318 const auto spellInfo = sSpellMgr.getSpellInfo(tradeData->getSpell());
319 const auto castedFromItem = tradeData->getSpellCastItem();
320 // Check if the spell is valid and target item exists
321 if (spellInfo == nullptr || (castedFromItem == nullptr && tradeData->hasSpellCastItem()) || targetTradeData->getTradeItem(TRADE_SLOT_NONTRADED) == nullptr)
322 {
323 tradeData->setTradeSpell(0);
324 return;
325 }
326
327 // Generate spell target
328 playerSpellTargets.setItemTarget(TRADE_SLOT_NONTRADED);
329 playerSpellTargets.addTargetMask(TARGET_FLAG_TRADE_ITEM);
330 // Create spell
331 playerSpell = sSpellMgr.newSpell(_player, spellInfo, true, nullptr);
332 playerSpell->setItemCaster(castedFromItem);
333 playerSpell->m_targets = playerSpellTargets;
334
335 // Check if player is able to cast the spell
336 const auto castResult = playerSpell->canCast(true, 0, 0);
337 if (castResult != SPELL_CAST_SUCCESS)
338 {
339 playerSpell->sendCastResult(castResult);
340 tradeData->setTradeSpell(0);
341
342 delete playerSpell;
343 return;
344 }
345 }
346
347 // Check trader's spell on the lowest item
348 Spell* traderSpell = nullptr;
349 SpellCastTargets traderSpellTargets;
350 if (targetTradeData->getSpell() != 0)
351 {
352 const auto spellInfo = sSpellMgr.getSpellInfo(targetTradeData->getSpell());
353 const auto castedFromItem = targetTradeData->getSpellCastItem();
354 // Check if the spell is valid and target item exists
355 if (spellInfo == nullptr || (castedFromItem == nullptr && targetTradeData->hasSpellCastItem()) || tradeData->getTradeItem(TRADE_SLOT_NONTRADED) == nullptr)
356 {
357 targetTradeData->setTradeSpell(0);
358 return;
359 }
360
361 // Generate spell target
362 traderSpellTargets.setItemTarget(TRADE_SLOT_NONTRADED);
363 traderSpellTargets.addTargetMask(TARGET_FLAG_TRADE_ITEM);
364 // Create spell
365 traderSpell = sSpellMgr.newSpell(tradeData->getTradeTarget(), spellInfo, true, nullptr);
366 traderSpell->setItemCaster(castedFromItem);
367 traderSpell->m_targets = traderSpellTargets;
368
369 // Check if trader is able to cast the spell
370 const auto castResult = traderSpell->canCast(true, 0, 0);
371 if (castResult != SPELL_CAST_SUCCESS)
372 {
373 traderSpell->sendCastResult(castResult);
374 targetTradeData->setTradeSpell(0);
375
376 delete traderSpell;
377 return;
378 }
379 }
380
381 std::array<std::unique_ptr<Item>, TRADE_SLOT_TRADED_COUNT> tradeItems = { nullptr };
382 std::array<std::unique_ptr<Item>, TRADE_SLOT_TRADED_COUNT> targetTradeItems = { nullptr };
383
384 // Remove items
385 for (uint8_t i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
386 {
387 if (auto* const tradeItem = tradeData->getTradeItem(static_cast<TradeSlots>(i)))
388 {
389 tradeItem->setGiftCreatorGuid(_player->getGuid());
390 // TODO: what about temp enchantments and refundable items since old owner has pointers to the item
391#if VERSION_STRING >= WotLK
392 if (tradeItem->hasFlags(ITEM_FLAG_BOP_TRADEABLE))
394#endif
395
396 tradeItems[i] = _player->getItemInterface()->SafeRemoveAndRetreiveItemByGuid(tradeItem->getGuid(), true);
397 }
398 if (auto* const targetTradeItem = targetTradeData->getTradeItem(static_cast<TradeSlots>(i)))
399 {
400 targetTradeItem->setGiftCreatorGuid(tradeTarget->getGuid());
401#if VERSION_STRING >= WotLK
402 if (targetTradeItem->hasFlags(ITEM_FLAG_BOP_TRADEABLE))
403 tradeTarget->getItemInterface()->removeTradeableItem(targetTradeItem);
404#endif
405
406 targetTradeItems[i] = tradeTarget->getItemInterface()->SafeRemoveAndRetreiveItemByGuid(targetTradeItem->getGuid(), true);
407 }
408 }
409
410 // Add items
411 for (uint8_t i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
412 {
413 if (tradeItems[i] != nullptr)
414 {
415 tradeItems[i]->setOwner(tradeTarget);
416#if VERSION_STRING >= WotLK
417 if (tradeItems[i]->hasFlags(ITEM_FLAG_BOP_TRADEABLE))
418 tradeTarget->getItemInterface()->addTradeableItem(tradeItems[i].get());
419#endif
420
421 tradeTarget->getItemInterface()->AddItemToFreeSlot(std::move(tradeItems[i]));
422 }
423 if (targetTradeItems[i] != nullptr)
424 {
425 targetTradeItems[i]->setOwner(_player);
426#if VERSION_STRING >= WotLK
427 if (targetTradeItems[i]->hasFlags(ITEM_FLAG_BOP_TRADEABLE))
428 _player->getItemInterface()->addTradeableItem(targetTradeItems[i].get());
429#endif
430
431 _player->getItemInterface()->AddItemToFreeSlot(std::move(targetTradeItems[i]));
432 }
433 }
434
435 // Trade money
436 if (targetTradeData->getTradeMoney() > 0)
437 {
438#if VERSION_STRING < Cata
439 _player->modCoinage((int32_t)targetTradeData->getTradeMoney());
440 tradeTarget->modCoinage(-(int32_t)targetTradeData->getTradeMoney());
441#else
442 _player->modCoinage((int64_t)targetTradeData->getTradeMoney());
443 tradeTarget->modCoinage(-(int64_t)targetTradeData->getTradeMoney());
444#endif
445 }
446
447 if (tradeData->getTradeMoney() > 0)
448 {
449#if VERSION_STRING < Cata
450 tradeTarget->modCoinage((int32_t)tradeData->getTradeMoney());
451 _player->modCoinage(-(int32_t)tradeData->getTradeMoney());
452#else
453 tradeTarget->modCoinage((int64_t)tradeData->getTradeMoney());
454 _player->modCoinage(-(int64_t)tradeData->getTradeMoney());
455#endif
456 }
457
458 // Cast spells
459 if (playerSpell != nullptr)
460 playerSpell->prepare(&playerSpellTargets);
461
462 if (traderSpell != nullptr)
463 traderSpell->prepare(&traderSpellTargets);
464
465 _player->m_TradeData = nullptr;
466 tradeTarget->m_TradeData = nullptr;
467
469 tradeTarget->getSession()->sendTradeResult(TRADE_STATUS_COMPLETE);
470
471 _player->saveToDB(false);
472 tradeTarget->saveToDB(false);
473}
@ ITEM_FLAG_BOP_TRADEABLE
@ INV_ERR_TOO_MUCH_GOLD
@ INV_ERR_INVENTORY_FULL
@ TRADE_STATUS_ACCEPTED
@ TRADE_STATUS_COMPLETE
TradeSlots
@ TRADE_SLOT_TRADED_COUNT
@ TRADE_SLOT_NONTRADED
@ TARGET_FLAG_TRADE_ITEM
@ SPELL_CAST_SUCCESS
#define sSpellMgr
Definition SpellMgr.hpp:197
#define worldConfig
Definition World.h:245
void buildInventoryChangeError(Item const *srcItem, Item const *dstItem, uint8_t inventoryError, uint32_t srcItemId=0)
uint32_t CalculateFreeSlots(ItemProperties const *proto)
Calculates inventory free slots, bag inventory slots not included.
void addTradeableItem(Item *item)
void removeTradeableItem(Item *item)
std::unique_ptr< Item > SafeRemoveAndRetreiveItemByGuid(uint64_t guid, bool destroy)
Removes the item safely by guid and returns it back for usage, supports full inventory.
std::tuple< AddItemResult, std::unique_ptr< Item > > AddItemToFreeSlot(std::unique_ptr< Item > item)
Adds a Item to a free slot.
Definition Item.hpp:43
void setGiftCreatorGuid(uint64_t guid)
Definition Item.cpp:141
bool hasFlags(uint32_t flags) const
Definition Item.cpp:191
bool isTradeableWith(Player *player)
Definition Item.cpp:1154
bool isContainer() const
Definition Object.cpp:574
TradeData * getTradeData() const
Definition Player.cpp:6506
uint64_t getCoinage() const
Definition Player.cpp:1184
void modCoinage(int64_t coinage)
Definition Player.cpp:1187
void cancelTrade(bool sendToSelfAlso, bool silently=false)
Definition Player.cpp:6511
std::unique_ptr< TradeData > m_TradeData
Definition Player.hpp:1050
void saveToDB(bool newCharacter)
Definition Player.cpp:14132
WorldSession * getSession() const
Definition Player.cpp:3131
void setItemTarget(uint64_t guid)
void addTargetMask(uint32_t mask)
SpellCastTargets m_targets
Definition Spell.hpp:535
virtual SpellCastResult canCast(const bool secondCheck, uint32_t *parameter1, uint32_t *parameter2)
Definition Spell.cpp:1560
SpellCastResult prepare(SpellCastTargets *targets)
Definition Spell.cpp:255
void sendCastResult(SpellCastResult result, uint32_t parameter1=0, uint32_t parameter2=0)
Definition Spell.cpp:4552
void setItemCaster(Item *itemCaster)
Definition Spell.cpp:5654
Player * getTradeTarget() const
Definition TradeData.cpp:26
void setTradeAccepted(bool state, bool sendBoth=false)
void sendTradeResult(TradeStatus result, uint64_t guid=0)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAchievmentQueryOpcode()

void WorldSession::handleAchievmentQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 96 of file QueryHandler.cpp.

97{
98#if VERSION_STRING > TBC
100 if (!srlPacket.deserialise(recvPacket))
101 return;
102
103 auto player = sObjectMgr.getPlayer(srlPacket.guid.getGuidLow());
104 if (player == nullptr)
105 return;
106
107#if VERSION_STRING >= Cata
108 player->getAchievementMgr()->sendRespondInspectAchievements(_player);
109#else
110 player->getAchievementMgr()->sendAllAchievementData(_player);
111#endif
112
113#endif
114}
virtual bool deserialise(WorldPacket &packet)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAcknowledgementOpcodes()

void WorldSession::handleAcknowledgementOpcodes ( WorldPacket recvPacket)
protected

Definition at line 470 of file MovementHandler.cpp.

471{
472 sLogger.debug("Opcode {} ({}) received. This opcode is not known/implemented right now!",
473 sOpcodeTables.getNameForInternalId(recvPacket.GetOpcode()), recvPacket.GetOpcode());
474
475 recvPacket.rfinish();
476}
#define sOpcodeTables
void rfinish()
Definition ByteBuffer.h:417
uint16_t GetOpcode() const
Definition WorldPacket.h:27
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleActivateTaxiOpcode()

void WorldSession::handleActivateTaxiOpcode ( WorldPacket recvPacket)
protected

Definition at line 172 of file TaxiHandler.cpp.

173{
174 CmsgActivateTaxi srlPacket;
175 if (!srlPacket.deserialise(recvPacket))
176 return;
177
178 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_ACTIVATE_TAXI");
179
181 if (!npc)
182 {
184 return;
185 }
186
187 if (!GetPlayer()->m_cheats.hasTaxiCheat)
188 {
189 if (!GetPlayer()->m_taxi->isTaximaskNodeKnown(srlPacket.nodes[0]) || !GetPlayer()->m_taxi->isTaximaskNodeKnown(srlPacket.nodes[1]))
190 {
192 return;
193 }
194 }
195
196 // interrupt all casts
197 for (uint8_t i = 0; i < CURRENT_SPELL_MAX; ++i)
199
200 GetPlayer()->activateTaxiPathTo(srlPacket.nodes, npc);
201}
@ UNIT_NPC_FLAG_TAXI
CurrentSpellType
Definition Object.hpp:65
@ CURRENT_SPELL_MAX
Definition Object.hpp:70
void interruptSpellWithSpellType(CurrentSpellType spellType)
Definition Object.cpp:713
Creature * getCreatureWhenICanInteract(WoWGuid const &guid, uint32_t npcflagmask)
Definition Player.cpp:16884
bool activateTaxiPathTo(std::vector< uint32_t > const &nodes, Creature *npc=nullptr, uint32_t spellid=0)
Definition Player.cpp:10513
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAddFriendOpcode()

void WorldSession::handleAddFriendOpcode ( WorldPacket recvPacket)
protected

Definition at line 26 of file SocialHandler.cpp.

27{
28 CmsgAddFriend srlPacket;
29 if (!srlPacket.deserialise(recvPacket))
30 return;
31
32 _player->addToFriendList(srlPacket.name, !srlPacket.note.empty() ? srlPacket.note : "");
33}
void addToFriendList(std::string name, std::string note)
Definition Player.cpp:9120
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAddIgnoreOpcode()

void WorldSession::handleAddIgnoreOpcode ( WorldPacket recvPacket)
protected

Definition at line 44 of file SocialHandler.cpp.

45{
46 CmsgAddIgnore srlPacket;
47 if (!srlPacket.deserialise(recvPacket))
48 return;
49
50 _player->addToIgnoreList(srlPacket.name);
51}
void addToIgnoreList(std::string name)
Definition Player.cpp:9303
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAddonRegisteredPrefixesOpcode()

void WorldSession::handleAddonRegisteredPrefixesOpcode ( WorldPacket recvPacket)
protected

Definition at line 2272 of file MiscHandler.cpp.

2273{
2274#if VERSION_STRING >= Cata
2275 uint32_t addonCount = recvPacket.readBits(25);
2276
2277 if (addonCount > 64)
2278 {
2279 isAddonMessageFiltered = false;
2280 recvPacket.rfinish();
2281 return;
2282 }
2283
2284 std::vector<uint8_t> nameLengths(addonCount);
2285 for (uint32_t i = 0; i < addonCount; ++i)
2286 nameLengths[i] = static_cast<uint8_t>(recvPacket.readBits(5));
2287
2288 for (uint32_t i = 0; i < addonCount; ++i)
2289 mRegisteredAddonPrefixesVector.push_back(recvPacket.ReadString(nameLengths[i]));
2290
2291 if (mRegisteredAddonPrefixesVector.size() > 64)
2292 {
2293 isAddonMessageFiltered = false;
2294 return;
2295 }
2296
2298#endif
2299}
std::string ReadString(uint32_t length)
Definition ByteBuffer.h:137
uint32_t readBits(int32_t bits)
Definition ByteBuffer.h:188
std::vector< std::string > mRegisteredAddonPrefixesVector
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAmmoSetOpcode()

void WorldSession::handleAmmoSetOpcode ( WorldPacket recvPacket)
protected

Definition at line 1797 of file MiscHandler.cpp.

1798{
1799 uint32_t ammoId;
1800 recvPacket >> ammoId;
1801
1802 if (!ammoId)
1803 return;
1804
1805 const auto itemProperties = sMySQLStore.getItemProperties(ammoId);
1806 if (!itemProperties)
1807 return;
1808
1809 if (itemProperties->Class != ITEM_CLASS_PROJECTILE || _player->getItemInterface()->GetItemCount(ammoId) == 0)
1810 {
1811 sCheatLog.writefromsession(_player->getSession(), "Definitely cheating. tried to add %u as ammo.", ammoId);
1813 return;
1814 }
1815
1816 if (itemProperties->RequiredLevel)
1817 {
1818 if (_player->getLevel() < itemProperties->RequiredLevel)
1819 {
1821#if VERSION_STRING < Cata
1822 _player->setAmmoId(0);
1823#endif
1825 return;
1826 }
1827 }
1828 if (itemProperties->RequiredSkill)
1829 {
1830 if (!_player->hasSkillLine(itemProperties->RequiredSkill))
1831 {
1833#if VERSION_STRING < Cata
1834 _player->setAmmoId(0);
1835#endif
1837 return;
1838 }
1839
1840 if (itemProperties->RequiredSkillRank)
1841 {
1842 if (_player->getSkillLineCurrent(itemProperties->RequiredSkill, false) < itemProperties->RequiredSkillRank)
1843 {
1845#if VERSION_STRING < Cata
1846 _player->setAmmoId(0);
1847#endif
1849 return;
1850 }
1851 }
1852 }
1853 switch (_player->getClass())
1854 {
1855 case PRIEST: // allowing priest, warlock, mage to equip ammo will mess up wand shoot. stop it.
1856 case WARLOCK:
1857 case MAGE:
1858 case SHAMAN: // these don't get messed up since they don't use wands, but they don't get to use bows/guns/crossbows anyways
1859 case DRUID: // we wouldn't want them cheating extra stats from ammo, would we?
1860 case PALADIN:
1861#if VERSION_STRING > TBC
1862 case DEATHKNIGHT:
1863#endif
1865#if VERSION_STRING < Cata
1866 _player->setAmmoId(0);
1867#endif
1869 return;
1870 default:
1871#if VERSION_STRING < Cata
1872 _player->setAmmoId(ammoId);
1873#endif
1875 break;
1876 }
1877}
@ ITEM_CLASS_PROJECTILE
@ INV_ERR_YOU_CAN_NEVER_USE_THAT_ITEM
@ INV_ERR_ITEM_RANK_NOT_ENOUGH
@ PRIEST
@ PALADIN
@ DRUID
@ SHAMAN
#define sCheatLog
uint32_t GetItemCount(uint32_t itemid, bool IncBank=false)
Finds item ammount on inventory, banks not included.
void calculateDamage() override
Definition Player.cpp:16612
uint16_t getSkillLineCurrent(uint16_t skillLine, bool includeBonus=true) const
Definition Player.cpp:4928
bool hasSkillLine(uint16_t skillLine, bool strict=false) const
Definition Player.cpp:4912
uint8_t getClass() const
Definition Unit.cpp:456
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAreaSpiritHealerQueryOpcode()

void WorldSession::handleAreaSpiritHealerQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 211 of file BattlegroundHandler.cpp.

212{
213 const auto Battleground = _player->m_bg;
214 if (Battleground == nullptr)
215 return;
216
218 if (!srlPacket.deserialise(recvPacket))
219 return;
220
221 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AREA_SPIRIT_HEALER_QUEUE: {} (guidLowPart)", srlPacket.guid.getGuidLowPart());
222
223 const auto spiritHealer = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
224 if (spiritHealer == nullptr)
225 return;
226
227 uint32_t restTime = Battleground->getLastResurrect() + 30;
228 if (static_cast<uint32_t>(UNIXTIME) > restTime)
229 restTime = 1000;
230 else
231 restTime = (restTime - static_cast<uint32_t>(UNIXTIME)) * 1000;
232
233 SendPacket(SmsgAreaSpiritHealerTime(srlPacket.guid.getRawGuid(), restTime).serialise().get());
234}
uint32_t getLastResurrect()
Battleground * m_bg
Definition Player.hpp:1455
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAreaSpiritHealerQueueOpcode()

void WorldSession::handleAreaSpiritHealerQueueOpcode ( WorldPacket recvPacket)
protected

Definition at line 191 of file BattlegroundHandler.cpp.

192{
193 const auto Battleground = _player->m_bg;
194 if (Battleground == nullptr)
195 return;
196
198 if (!srlPacket.deserialise(recvPacket))
199 return;
200
201 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AREA_SPIRIT_HEALER_QUEUE: {} (guidLowPart)", srlPacket.guid.getGuidLowPart());
202
203 const auto spiritHealer = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
204 if (spiritHealer == nullptr)
205 return;
206
208 _player->castSpell(_player, 2584, true);
209}
void queuePlayerForResurrect(Player *plr, Creature *spirit_healer)
SpellCastResult castSpell(uint64_t targetGuid, uint32_t spellId, bool triggered=false)
Definition Unit.cpp:3564
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAreaTriggerOpcode()

void WorldSession::handleAreaTriggerOpcode ( WorldPacket recvPacket)
protected

Definition at line 27 of file AreaTriggerHandler.cpp.

28{
29 CmsgAreatrigger srlPacket;
30 if (!srlPacket.deserialise(recvPacket))
31 return;
32
33 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AREATRIGGER: {} (triggerId)", srlPacket.triggerId);
34
35 if (!_player->IsInWorld())
36 return;
37
38 sQuestMgr.OnPlayerExploreArea(_player, srlPacket.triggerId);
39
40 const auto areaTriggerEntry = sAreaTriggerStore.lookupEntry(srlPacket.triggerId);
41 if (areaTriggerEntry == nullptr)
42 {
43 sLogger.debug("{} is not part of AreaTrigger.dbc", srlPacket.triggerId);
44 return;
45 }
46
47 sHookInterface.OnAreaTrigger(_player, srlPacket.triggerId);
48
51
52 if (_player->m_bg)
53 {
55 return;
56 }
57
58 const auto areaTrigger = sMySQLStore.getAreaTrigger(srlPacket.triggerId);
59 if (areaTrigger == nullptr)
60 return;
61
62 if (_player->GetMapId() != areaTrigger->mapId)
63 {
64 const auto mapInfo = sMySQLStore.getWorldMapInfo(areaTrigger->mapId);
65 EnterState denyReason = sMapMgr.canPlayerEnter(areaTrigger->mapId, areaTrigger->requiredLevel, _player, false);
66
67 if (denyReason != CAN_ENTER)
68 {
69 char buffer[200];
70
71 const auto session = _player->getSession();
72
73 switch (denyReason)
74 {
76 {
77 _player->sendPacket(SmsgRaidGroupOnly(0, 2).serialise().get());
78 } break;
80 {
82 _player->sendPacket(&data);
83 } break;
85 {
87 } break;
89 {
91 } break;
93 {
95 } break;
97 {
99 } break;
101 {
102 snprintf(buffer, 200, session->LocalizedWorldSrv(ServerString::SS_MUST_BE_LEVEL_X), areaTrigger->requiredLevel);
104 } break;
106 {
107 const auto itemProperties = sMySQLStore.getItemProperties(mapInfo->required_item);
108 snprintf(buffer, 200, session->LocalizedWorldSrv(ServerString::SS_MUST_HAVE_ITEM), itemProperties ? itemProperties->Name.c_str() : "UNKNOWN");
110 } break;
112 {
113 const auto questProperties = sMySQLStore.getQuestProperties(mapInfo->required_quest_A);
114 snprintf(buffer, 200, session->LocalizedWorldSrv(ServerString::SS_MUST_HAVE_QUEST), questProperties ? questProperties->title.c_str() : "UNKNOWN");
116 } break;
118 {
119 const auto questProperties = sMySQLStore.getQuestProperties(mapInfo->required_quest_H);
120 snprintf(buffer, 200, session->LocalizedWorldSrv(ServerString::SS_MUST_HAVE_QUEST), questProperties ? questProperties->title.c_str() : "UNKNOWN");
122 } break;
123 case CANNOT_ENTER_KEY:
124 {
125 const auto itemProperties = sMySQLStore.getItemProperties(mapInfo->heroic_key_1);
126 snprintf(buffer, 200, session->LocalizedWorldSrv(ServerString::SS_MUST_HAVE_ITEM), itemProperties ? itemProperties->Name.c_str() : "UNKNOWN");
128 } break;
130 {
131 snprintf(buffer, 200, session->LocalizedWorldSrv(ServerString::SS_MUST_BE_LEVEL_X), mapInfo->minlevel_heroic);
133 } break;
134 default:
135 break;
136 }
137 return;
138 }
139 }
140
141 switch (areaTrigger->type)
142 {
143 case ATTYPE_INSTANCE:
144 {
146 break;
147
148 if (!_player->isOnTaxi())
149 {
150 _player->setMapEntryPoint(areaTrigger->mapId);
151 _player->safeTeleport(areaTrigger->mapId, 0, LocationVector(areaTrigger->x, areaTrigger->y, areaTrigger->z, areaTrigger->o));
152 }
153 } break;
155 {
156
157 } break;
158 case ATTYPE_INN:
159 {
160 if (!_player->m_isResting)
162 } break;
163 case ATTYPE_TELEPORT:
164 {
166 {
167 _player->setMapEntryPoint(areaTrigger->mapId);
168 _player->safeTeleport(areaTrigger->mapId, 0, LocationVector(areaTrigger->x, areaTrigger->y, areaTrigger->z, areaTrigger->o));
169 }
170 } break;
171 default:
172 break;
173 }
174}
@ CANNOT_ENTER_MAX_PLAYERS
@ CANNOT_ENTER_MIN_LEVEL_HC
@ CANNOT_ENTER_TOO_MANY_INSTANCES
@ CAN_ENTER
@ CANNOT_ENTER_ENCOUNTER
@ CANNOT_ENTER_NOT_IN_RAID
@ CANNOT_ENTER_INSTANCE_BIND_MISMATCH
@ CANNOT_ENTER_ATTUNE_QH
@ CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE
@ CANNOT_ENTER_MIN_LEVEL
@ CANNOT_ENTER_KEY
@ CANNOT_ENTER_ATTUNE_ITEM
@ CANNOT_ENTER_ATTUNE_QA
INSTANCE_ABORT_ERROR
@ INSTANCE_ABORT_FULL
@ INSTANCE_ABORT_ENCOUNTER
@ INSTANCE_ABORT_TOO_MANY
#define sMapMgr
Definition MapMgr.hpp:91
@ ATTYPE_INN
@ ATTYPE_TELEPORT
@ ATTYPE_QUESTTRIGGER
@ ATTYPE_INSTANCE
@ SMSG_CORPSE_NOT_IN_INSTANCE
Definition Opcodes.hpp:1419
SERVER_DECL WDB::WDBContainer< WDB::Structures::AreaTriggerEntry > sAreaTriggerStore
Definition WDBStores.cpp:56
@ SS_MUST_BE_LEVEL_X
@ SS_MUST_HAVE_QUEST
@ SS_MUST_HAVE_ITEM
virtual void HookOnAreaTrigger(Player *plr, uint32_t id)=0
virtual void OnAreaTrigger(Player *, uint32_t)
uint32_t GetMapId() const
Definition Object.hpp:468
bool isOnTaxi() const
Definition Player.cpp:10775
bool isTransferPending() const
Definition Player.cpp:1891
void sendAreaTriggerMessage(const char *message,...)
Definition Player.cpp:6563
bool safeTeleport(uint32_t mapId, uint32_t instanceId, const LocationVector &vec)
Definition Player.cpp:1772
void setMapEntryPoint(uint32_t mapId)
Definition Player.cpp:2050
InstanceScript * getScript()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleArenaJoinOpcode()

void WorldSession::handleArenaJoinOpcode ( WorldPacket recvPacket)
protected

Definition at line 79 of file BattlegroundHandler.cpp.

80{
82 {
83 SystemMessage("You are already in a queud group for battlegrounds.");
84 return;
85 }
86
88 sBattlegroundManager.removePlayerFromQueues(_player);
89
91 if (!srlPacket.deserialise(recvPacket))
92 return;
93
94 uint32_t battlegroundType;
95
96 switch (srlPacket.category)
97 {
98 case 0:
99 battlegroundType = BattlegroundDef::TYPE_ARENA_2V2;
100 break;
101 case 1:
102 battlegroundType = BattlegroundDef::TYPE_ARENA_3V3;
103 break;
104 case 2:
105 battlegroundType = BattlegroundDef::TYPE_ARENA_5V5;
106 break;
107 default:
108 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_BATTLEMASTER_JOIN_ARENA: with invalid category ({})", srlPacket.category);
109 battlegroundType = 0;
110 break;
111 }
112
113 if (battlegroundType != 0)
114 sBattlegroundManager.handleArenaJoin(this, battlegroundType, srlPacket.asGroup, srlPacket.ratedMatch);
115}
#define sBattlegroundManager
bool m_isqueued
Definition Group.h:235
bool m_isQueuedForBg
Definition Player.hpp:1458
Group * getGroup()
Definition Player.cpp:7887
void SystemMessage(const char *format,...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleArenaTeamAddMemberOpcode()

void WorldSession::handleArenaTeamAddMemberOpcode ( WorldPacket recvPacket)
protected

Definition at line 43 of file ArenaTeamHandler.cpp.

44{
45 CmsgArenaTeamInvite srlPacket;
46 if (!srlPacket.deserialise(recvPacket))
47 return;
48
49 auto arenaTeam = sObjectMgr.getArenaTeamById(srlPacket.teamId);
50 if (arenaTeam == nullptr)
51 return;
52
53 if (!arenaTeam->isMember(GetPlayer()->getGuidLow()))
54 {
56 return;
57 }
58
59 auto player = sObjectMgr.getPlayer(srlPacket.playerName.c_str(), false);
60 if (player == nullptr)
61 {
62 SystemMessage("Player `%s` is non-existent or not online.", srlPacket.playerName.c_str());
63 return;
64 }
65
66 if (arenaTeam->m_leader != _player->getGuidLow())
67 {
68 SystemMessage("You are not the captain of this arena team.");
69 return;
70 }
71
72 if (player->getLevel() < PLAYER_ARENA_MIN_LEVEL)
73 {
74 SystemMessage("Player must be level %u to join an arena team.", PLAYER_ARENA_MIN_LEVEL);
75 return;
76 }
77
78 if (player->getArenaTeam(arenaTeam->m_type) != nullptr)
79 {
80 SystemMessage("That player is already in an arena team of this type.");
81 return;
82 }
83
84 if (player->getInviteArenaTeamId() != 0)
85 {
86 SystemMessage("That player is already invited to an arena team");
87 return;
88 }
89
90 if (player->getTeam() != _player->getTeam() && !HasGMPermissions())
91 {
92 SystemMessage("That player is a member of a different faction.");
93 return;
94 }
95
96 player->setInviteArenaTeamId(_player->getArenaTeam(arenaTeam->m_type)->m_id);
97
98 player->sendPacket(SmsgArenaTeamInvite(_player->getName(), _player->getArenaTeam(arenaTeam->m_type)->m_name).serialise().get());
99}
#define PLAYER_ARENA_MIN_LEVEL
uint32_t m_id
Definition ArenaTeam.hpp:89
std::string m_name
Definition ArenaTeam.hpp:93
void softDisconnect()
Definition Player.cpp:3147
ArenaTeam * getArenaTeam(uint8_t type)
Definition Player.cpp:8070
bool HasGMPermissions() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleArenaTeamDisbandOpcode()

void WorldSession::handleArenaTeamDisbandOpcode ( WorldPacket recvPacket)
protected

Definition at line 252 of file ArenaTeamHandler.cpp.

253{
254 CmsgArenaTeamDisband srlPacket;
255 if (!srlPacket.deserialise(recvPacket))
256 return;
257
258 auto arenaTeam = sObjectMgr.getArenaTeamById(srlPacket.teamId);
259 if (arenaTeam == nullptr)
260 {
262 return;
263 }
264
265 if ((arenaTeam = _player->getArenaTeam(arenaTeam->m_type)) == nullptr)
266 {
267 SystemMessage("You are not in an arena team of this type.");
268 return;
269 }
270
271 if (arenaTeam->m_leader != _player->getGuidLow())
272 {
273 SystemMessage("You aren't the captain of this team.");
274 return;
275 }
276
277 arenaTeam->destroy();
278}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleArenaTeamInviteAcceptOpcode()

void WorldSession::handleArenaTeamInviteAcceptOpcode ( WorldPacket )
protected

Definition at line 152 of file ArenaTeamHandler.cpp.

153{
154 if (_player->getInviteArenaTeamId() == 0)
155 {
156 SystemMessage("You have not been invited into another arena team.");
157 return;
158 }
159
160 auto arenaTeam = sObjectMgr.getArenaTeamById(_player->getInviteArenaTeamId());
161 if (arenaTeam == nullptr)
162 {
163 SystemMessage("That arena team no longer exists.");
164 return;
165 }
166
167 if (arenaTeam->m_memberCount >= arenaTeam->m_slots)
168 {
169 SystemMessage("That team is now full.");
170 return;
171 }
172
173 if (_player->getArenaTeam(arenaTeam->m_type) != nullptr)
174 {
175 SystemMessage("You have already been in an arena team of that size.");
176 return;
177 }
178
179 if (arenaTeam->addMember(_player->m_playerInfo))
180 {
181 _player->setArenaTeam(arenaTeam->m_type, arenaTeam);
182
183 char buffer[1024];
184 snprintf(buffer, 1024, "%s joined the arena team, '%s'.", _player->getName().c_str(), arenaTeam->m_name.c_str());
185
186 arenaTeam->sendPacket(SmsgMessageChat(SystemMessagePacket(buffer)).serialise().get());
187 }
188 else
189 {
190 SendNotification("Internal error.");
191 }
192}
void setArenaTeam(uint8_t type, ArenaTeam *arenaTeam)
Definition Player.cpp:8063
CachedCharacterInfo * m_playerInfo
Definition Player.hpp:747
uint32_t getInviteArenaTeamId() const
Definition Player.cpp:8129
void SendNotification(const char *message,...)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleArenaTeamInviteDenyOpcode()

void WorldSession::handleArenaTeamInviteDenyOpcode ( WorldPacket )
protected

Definition at line 194 of file ArenaTeamHandler.cpp.

195{
196 if (_player->getInviteArenaTeamId() == 0)
197 {
198 SystemMessage("You were not invited.");
199 return;
200 }
201
202 const auto* team = sObjectMgr.getArenaTeamById(_player->getInviteArenaTeamId());
203 if (team == nullptr)
204 return;
205
206 if (const auto player = sObjectMgr.getPlayer(team->m_leader))
207 player->getSession()->SystemMessage("%s denied your arena team invitation for %s.", _player->getName().c_str(), team->m_name.c_str());
208}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleArenaTeamLeaveOpcode()

void WorldSession::handleArenaTeamLeaveOpcode ( WorldPacket recvPacket)
protected

Definition at line 210 of file ArenaTeamHandler.cpp.

211{
212 CmsgArenaTeamLeave srlPacket;
213 if (!srlPacket.deserialise(recvPacket))
214 return;
215
216 auto arenaTeam = sObjectMgr.getArenaTeamById(srlPacket.teamId);
217 if (arenaTeam == nullptr)
218 {
220 return;
221 }
222
223 if ((arenaTeam = _player->getArenaTeam(arenaTeam->m_type)) == nullptr)
224 {
225 SystemMessage("You are not in an arena team of this type.");
226 return;
227 }
228
229 if (arenaTeam->m_leader == _player->getGuidLow() && arenaTeam->m_memberCount == 1)
230 {
231 arenaTeam->destroy();
232 return;
233 }
234
235 if (arenaTeam->m_leader == _player->getGuidLow())
236 {
237 SystemMessage("You cannot leave the team yet, promote someone else to captain first.");
238 return;
239 }
240
241 if (arenaTeam->removeMember(_player->m_playerInfo))
242 {
243 char buffer[1024];
244 snprintf(buffer, 1024, "%s left the arena team, '%s'.", _player->getName().c_str(), arenaTeam->m_name.c_str());
245
246 arenaTeam->sendPacket(SmsgMessageChat(SystemMessagePacket(buffer)).serialise().get());
247
248 SystemMessage("You have left the arena team, '%s'.", arenaTeam->m_name.c_str());
249 }
250}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleArenaTeamPromoteOpcode()

void WorldSession::handleArenaTeamPromoteOpcode ( WorldPacket recvPacket)
protected

Definition at line 280 of file ArenaTeamHandler.cpp.

281{
282 CmsgArenaTeamLeader srlPacket;
283 if (!srlPacket.deserialise(recvPacket))
284 return;
285
286 auto arenaTeam = sObjectMgr.getArenaTeamById(srlPacket.teamId);
287 if (arenaTeam == nullptr)
288 {
290 return;
291 }
292
293 const auto slot = arenaTeam->m_type;
294
295 if (slot >= NUM_ARENA_TEAM_TYPES)
296 return;
297
298 if ((arenaTeam = _player->getArenaTeam(slot)) == nullptr)
299 {
300 SystemMessage("You are not in an arena team of this type.");
301 return;
302 }
303
304 if (arenaTeam->m_leader != _player->getGuidLow())
305 {
306 SystemMessage("You aren't the captain of this team.");
307 return;
308 }
309
310 const auto playerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.playerName);
311 if (playerInfo == nullptr)
312 {
313 SystemMessage("That player cannot be found.");
314 return;
315 }
316
317 if (!arenaTeam->isMember(playerInfo->guid))
318 {
319 SystemMessage("That player is not a member of your arena team.");
320 return;
321 }
322
323 arenaTeam->setLeader(playerInfo);
324}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleArenaTeamQueryOpcode()

void WorldSession::handleArenaTeamQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 28 of file ArenaTeamHandler.cpp.

29{
30 CmsgArenaTeamQuery srlPacket;
31 if (!srlPacket.deserialise(recvPacket))
32 return;
33
34 if (auto arenaTeam = sObjectMgr.getArenaTeamById(srlPacket.teamId))
35 {
36 SendPacket(SmsgArenaTeamQueryResponse(arenaTeam->m_id, arenaTeam->m_name,
37 arenaTeam->getPlayersPerTeam(), arenaTeam->m_emblem).serialise().get());
38
39 SendPacket(SmsgArenaTeamStats(arenaTeam->m_id, arenaTeam->m_stats).serialise().get());
40 }
41}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleArenaTeamRemoveMemberOpcode()

void WorldSession::handleArenaTeamRemoveMemberOpcode ( WorldPacket recvPacket)
protected

Definition at line 101 of file ArenaTeamHandler.cpp.

102{
103 CmsgArenaTeamRemove srlPacket;
104 if (!srlPacket.deserialise(recvPacket))
105 return;
106
107 auto arenaTeam = sObjectMgr.getArenaTeamById(srlPacket.teamId);
108 if (arenaTeam == nullptr)
109 {
111 return;
112 }
113
114 const auto slot = arenaTeam->m_type;
115
116 if ((arenaTeam = _player->getArenaTeam(slot)) == nullptr)
117 {
118 SystemMessage("You are not in an arena team of this type.");
119 return;
120 }
121
122 if (arenaTeam->m_leader != _player->getGuidLow())
123 {
124 SystemMessage("You are not the leader of this team.");
125 return;
126 }
127
128 const auto playerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.playerName);
129 if (playerInfo == nullptr)
130 {
131 SystemMessage("That player cannot be found.");
132 return;
133 }
134
135 if (!arenaTeam->isMember(playerInfo->guid))
136 {
137 SystemMessage("That player is not in your arena team.");
138 return;
139 }
140
141 if (arenaTeam->removeMember(playerInfo))
142 {
143 char buffer[1024];
144 snprintf(buffer, 1024, "%s was removed from the arena team '%s'.", playerInfo->name.c_str(), arenaTeam->m_name.c_str());
145
146 arenaTeam->sendPacket(SmsgMessageChat(SystemMessagePacket(buffer)).serialise().get());
147
148 SystemMessage("Removed %s from the arena team '%s'.", playerInfo->name.c_str(), arenaTeam->m_name.c_str());
149 }
150}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleArenaTeamRosterOpcode()

void WorldSession::handleArenaTeamRosterOpcode ( WorldPacket recvPacket)
protected

Definition at line 326 of file ArenaTeamHandler.cpp.

327{
328 CmsgArenaTeamRoster srlPacket;
329 if (!srlPacket.deserialise(recvPacket))
330 return;
331
332 if (auto arenaTeam = sObjectMgr.getArenaTeamById(srlPacket.teamId))
333 {
334 const auto memberList = arenaTeam->getRoosterMembers();
335 SendPacket(SmsgArenaTeamRooster(arenaTeam->m_id, static_cast<uint32_t>(memberList.size()), arenaTeam->getPlayersPerTeam(), memberList).serialise().get());
336 }
337}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAttackStopOpcode()

void WorldSession::handleAttackStopOpcode ( WorldPacket )
protected

Definition at line 36 of file CombatHandler.cpp.

37{
38 const auto unitTarget = _player->getWorldMap()->getUnit(_player->getTargetGuid());
39 if (unitTarget == nullptr)
40 return;
41
43 _player->smsg_AttackStop(unitTarget);
44}
void eventAttackStop()
Definition Player.cpp:13776
uint64_t getTargetGuid() const
Definition Unit.cpp:400
void smsg_AttackStop(Unit *pVictim)
Definition Unit.cpp:7533
Unit * getUnit(const uint64_t &guid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAttackSwingOpcode()

void WorldSession::handleAttackSwingOpcode ( WorldPacket recvPacket)
protected

Definition at line 14 of file CombatHandler.cpp.

15{
16 CmsgAttackSwing srlPacket;
17 if (!srlPacket.deserialise(recvPacket))
18 return;
19
20 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_ATTACKSWING: {} (guidLow)", srlPacket.guid.getGuidLow());
21
23 return;
24
25 const auto unitTarget = _player->getWorldMap()->getUnit(srlPacket.guid.getRawGuid());
26 if (unitTarget == nullptr)
27 return;
28
29 if (!_player->isValidTarget(unitTarget) || unitTarget->isDead())
30 return;
31
32 _player->smsg_AttackStart(unitTarget);
34}
bool isValidTarget(Object *target, SpellInfo const *bySpell=nullptr)
Definition Object.cpp:4073
void eventAttackStart()
Definition Player.cpp:13770
void smsg_AttackStart(Unit *pVictim)
Definition Unit.cpp:7541
uint32_t isStunned() const
Definition Unit.hpp:1351
uint32_t isFeared() const
Definition Unit.hpp:1354
uint32_t isPacified() const
Definition Unit.hpp:1348
bool isDead() const
Definition Unit.cpp:7872
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAuctionHelloOpcode()

void WorldSession::handleAuctionHelloOpcode ( WorldPacket recvPacket)
protected

Definition at line 101 of file NPCHandler.cpp.

102{
103 MsgAuctionHello srlPacket;
104 if (!srlPacket.deserialise(recvPacket))
105 return;
106
107 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUCTION_HELLO: {} (guidLowPart)", srlPacket.guid.getGuidLowPart());
108
109 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
110 if (creature == nullptr)
111 return;
112
113 sendAuctionList(creature);
114}
void sendAuctionList(Creature *creature)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAuctionListBidderItems()

void WorldSession::handleAuctionListBidderItems ( WorldPacket recvPacket)
protected

Definition at line 80 of file AuctionHandler.cpp.

81{
83 if (!srlPacket.deserialise(recvPacket))
84 return;
85
86 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUCTION_LIST_BIDDER_ITEMS {} (lowguid)", srlPacket.guid.getGuidLowPart());
87
88 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
89 if (creature == nullptr || creature->auctionHouse == nullptr)
90 return;
91
92 creature->auctionHouse->sendBidListPacket(_player, &recvPacket);
93}
void sendBidListPacket(Player *player, WorldPacket *packet)
AuctionHouse * auctionHouse
Definition Creature.h:348
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAuctionListItems()

void WorldSession::handleAuctionListItems ( WorldPacket recvPacket)
protected

Definition at line 42 of file AuctionHandler.cpp.

43{
44 CmsgAuctionListItems srlPacket;
45 if (!srlPacket.deserialise(recvPacket))
46 return;
47
48 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUCTION_LIST_ITEMS {} (guidLow)", srlPacket.guid.getGuidLowPart());
49
50 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
51 if (creature == nullptr || creature->auctionHouse == nullptr)
52 return;
53
54 creature->auctionHouse->sendAuctionList(_player, srlPacket);
55}
void sendAuctionList(Player *player, AscEmu::Packets::CmsgAuctionListItems srlPacket)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAuctionListOwnerItems()

void WorldSession::handleAuctionListOwnerItems ( WorldPacket recvPacket)
protected

Definition at line 27 of file AuctionHandler.cpp.

28{
30 if (!srlPacket.deserialise(recvPacket))
31 return;
32
33 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUCTION_LIST_OWNER_ITEMS {} (guidLow)", srlPacket.guid.getGuidLowPart());
34
35 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
36 if (creature == nullptr || creature->auctionHouse == nullptr)
37 return;
38
39 creature->auctionHouse->sendOwnerListPacket(_player, nullptr);
40}
void sendOwnerListPacket(Player *player, WorldPacket *packet)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAuctionListPendingSales()

void WorldSession::handleAuctionListPendingSales ( WorldPacket recvPacket)
protected

Definition at line 95 of file AuctionHandler.cpp.

96{
97#if VERSION_STRING > TBC
99 if (!srlPacket.deserialise(recvPacket))
100 return;
101
102 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUCTION_LIST_PRENDING_SALES {} (lowguid)", srlPacket.guid.getGuidLowPart());
103
104 //\todo SMSG_AUCTION_LIST_PENDING_SALES needs to be researched!
105#endif
106}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAuctionPlaceBid()

void WorldSession::handleAuctionPlaceBid ( WorldPacket recvPacket)
protected

Definition at line 222 of file AuctionHandler.cpp.

223{
224 CmsgAuctionPlaceBid srlPacket;
225 if (!srlPacket.deserialise(recvPacket))
226 return;
227
228 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUCTION_PLACE_BID: {} (auctionId), {} (price)", srlPacket.auctionId, srlPacket.price);
229
230 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
231 if (creature == nullptr || creature->auctionHouse == nullptr)
232 return;
233
234 const auto auctionHouse = creature->auctionHouse;
235 const auto auction = auctionHouse->getAuction(srlPacket.auctionId);
236 if (auction == nullptr || !auction->ownerGuid)
237 {
239 return;
240 }
241
242 if (auction->ownerGuid == _player->getGuid())
243 {
245 return;
246 }
247
248 if (auction->highestBid > srlPacket.price && srlPacket.price != auction->buyoutPrice)
249 {
251 return;
252 }
253
254 if (!_player->hasEnoughCoinage(srlPacket.price))
255 {
257 return;
258 }
259
260 _player->modCoinage(-static_cast<int32_t>(srlPacket.price));
261 if (auction->highestBidderGuid.getGuidLow() != 0)
262 {
263 char subject[100];
264 snprintf(subject, 100, "%u:0:0", static_cast<int>(auction->auctionItem->getEntry()));
265 sMailSystem.SendAutomatedMessage(MAIL_TYPE_AUCTION, auctionHouse->getId(), auction->highestBidderGuid, subject, "", auction->highestBid, 0, 0, MAIL_STATIONERY_AUCTION);
266
267 if (auction->highestBidderGuid != _player->getGuid())
268 auctionHouse->sendAuctionOutBidNotificationPacket(auction, _player->getGuid(), srlPacket.price);
269 }
270
271 if (auction->buyoutPrice == srlPacket.price)
272 {
273 auction->highestBidderGuid = _player->getGuid();
274 auction->highestBid = srlPacket.price;
275
276 auctionHouse->queueDeletion(auction, AUCTION_REMOVE_WON);
277
279 auctionHouse->sendAuctionBuyOutNotificationPacket(auction);
280 }
281 else
282 {
283 auction->highestBidderGuid = _player->getGuidLow();
284 auction->highestBid = srlPacket.price;
285 auction->updateInDB();
286
288 }
289}
@ AUCTION_REMOVE_WON
@ AUCTION_ACTION_BID
@ AUCTION_ERROR_NONE
@ AUCTION_ERROR_INTERNAL
@ AUCTION_ERROR_MONEY
@ AUCTION_ERROR_BID_OWN_AUCTION
@ MAIL_TYPE_AUCTION
Definition MailMgr.h:58
@ MAIL_STATIONERY_AUCTION
Definition MailMgr.h:89
#define sMailSystem
Definition MailMgr.h:189
Auction * getAuction(uint32_t id)
bool hasEnoughCoinage(uint64_t coinage) const
Definition Player.cpp:1186
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAuctionSellItem()

void WorldSession::handleAuctionSellItem ( WorldPacket recvPacket)
protected

Definition at line 108 of file AuctionHandler.cpp.

109{
110 CmsgAuctionSellItem srlPacket;
111 if (!srlPacket.deserialise(recvPacket))
112 return;
113
114 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUCTION_SELL_ITEM");
115
116 if (!srlPacket.bidMoney || !srlPacket.expireTime)
117 return;
118
119 const auto creature = _player->getWorldMap()->getCreature(srlPacket.auctioneerGuid.getGuidLowPart());
120 if (creature == nullptr || creature->auctionHouse == nullptr)
121 return;
122
123 const auto auctionHouse = creature->auctionHouse;
124
125 switch (srlPacket.expireTime * MINUTE)
126 {
127 case 1 * MIN_AUCTION_TIME:
128 case 2 * MIN_AUCTION_TIME:
129 case 4 * MIN_AUCTION_TIME:
130 break;
131 default:
132 return;
133 }
134
135 Item* items[MAX_AUCTION_ITEMS];
136
137 uint32_t finalCount = 0;
138
139 for (uint32_t i = 0; i < srlPacket.itemsCount; ++i)
140 {
141 const auto item = _player->getItemInterface()->GetItemByGUID(srlPacket.itemGuids[i]);
142 if (!item)
143 {
145 return;
146 }
147
148 items[i] = item;
149 finalCount += srlPacket.count[i];
150 }
151
152 if (!finalCount)
153 {
155 return;
156 }
157
158 for (uint32_t i = 0; i < srlPacket.itemsCount; ++i)
159 {
160 if (items[i] == nullptr || items[i]->getStackCount() < finalCount)
161 {
163 return;
164 }
165 }
166
167 for (uint32_t i = 0; i < srlPacket.itemsCount; ++i)
168 {
169 if (items[i] == nullptr)
170 {
172 return;
173 }
174
175 const uint32_t item_worth = items[i]->getItemProperties()->SellPrice * items[i]->getStackCount();
176 const uint32_t item_deposit = static_cast<uint32_t>(item_worth * auctionHouse->depositPercent) * static_cast<uint32_t>(srlPacket.expireTime / 240.0f);
177
178 if (!_player->hasEnoughCoinage(item_deposit))
179 {
181 return;
182 }
183
184 _player->modCoinage(-int32_t(item_deposit));
185
186 auto item = _player->getItemInterface()->SafeRemoveAndRetreiveItemByGuid(srlPacket.itemGuids[i], false);
187 if (!item)
188 {
190 return;
191 };
192
193 if (item->IsInWorld())
194 item->removeFromWorld();
195
196 item->setOwner(nullptr);
197 item->m_isDirty = true;
198 item->saveToDB(INVENTORY_SLOT_NOT_SET, 0, true, nullptr);
199
200 auto auction = std::make_unique<Auction>();
201 auction->buyoutPrice = srlPacket.buyoutPrice;
202 auction->expireTime = static_cast<uint32_t>(UNIXTIME) + srlPacket.expireTime * MINUTE;
203 auction->startPrice = srlPacket.bidMoney;
204 auction->highestBid = 0;
205 auction->highestBidderGuid = 0;
206 auction->Id = sAuctionMgr.generateAuctionId();
207 auction->ownerGuid = _player->getGuidLow();
208 auction->auctionItem = std::move(item);
209 auction->isRemoved = false;
210 auction->removedType = AUCTION_REMOVE_EXPIRED;
211 auction->depositAmount = item_deposit;
212
213 auction->saveToDB(auctionHouse->getId());
214 auctionHouse->addAuction(std::move(auction));
215
217 }
218
219 auctionHouse->sendOwnerListPacket(_player, &recvPacket);
220}
#define MIN_AUCTION_TIME
@ AUCTION_REMOVE_EXPIRED
@ AUCTION_ACTION_CREATE
#define MAX_AUCTION_ITEMS
@ AUCTION_ERROR_ITEM
#define sAuctionMgr
#define INVENTORY_SLOT_NOT_SET
uint64_t itemGuids[MAX_AUCTION_ITEMS]
ItemProperties const * getItemProperties() const
Definition Item.cpp:954
uint32_t getStackCount() const
Definition Item.cpp:143
void sendAuctionCommandResult(Auction *auction, uint32_t Action, uint32_t ErrorCode, uint32_t bidError=0)
Definition Player.cpp:6476
@ MINUTE
Definition Definitions.h:12
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAutoBankItemOpcode()

void WorldSession::handleAutoBankItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 2655 of file ItemHandler.cpp.

2656{
2657 CmsgAutobankItem srlPacket;
2658 if (!srlPacket.deserialise(recvPacket))
2659 return;
2660
2661 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUTO_BANK_ITEM Inventory slot: {} Source Slot: {}",
2662 static_cast<uint32_t>(srlPacket.srcInventorySlot), static_cast<uint32_t>(srlPacket.srcSlot));
2663
2664 Item* eitem = _player->getItemInterface()->GetInventoryItem(srlPacket.srcInventorySlot, srlPacket.srcSlot);
2665 if (!eitem)
2666 {
2668 return;
2669 }
2670
2671 const SlotResult slotresult = _player->getItemInterface()->FindFreeBankSlot(eitem->getItemProperties());
2672 if (!slotresult.Result)
2673 {
2675 }
2676 else
2677 {
2679 srlPacket.srcSlot, false);
2680 if (itemHolder == nullptr)
2681 return;
2682
2683 auto [result, returnedItem] = _player->getItemInterface()->SafeAddItem(std::move(itemHolder), slotresult.ContainerSlot, slotresult.Slot);
2684 if (!result)
2685 {
2686 sLogger.failure("Error while adding item to bank bag!");
2687 // TODO: if add fails, should item be sent in mail? now it's destroyed
2688 _player->getItemInterface()->SafeAddItem(std::move(returnedItem), srlPacket.srcInventorySlot, srlPacket.srcSlot);
2689 }
2690 }
2691}
@ INV_ERR_ITEM_NOT_FOUND
@ INV_ERR_BANK_FULL
Item * SafeAddItem(uint32_t ItemId, int8_t ContainerSlot, int16_t slot)
Creates and adds a item that can be manipulated after.
Item * GetInventoryItem(int16_t slot)
Gets a item from Inventory.
std::unique_ptr< Item > SafeRemoveAndRetreiveItemFromSlot(int8_t ContainerSlot, int16_t slot, bool destroy)
Removes the item safely and returns it back for usage.
SlotResult FindFreeBankSlot(ItemProperties const *proto)
int8_t ContainerSlot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAutoDeclineGuildInvites()

void WorldSession::handleAutoDeclineGuildInvites ( WorldPacket recvPacket)
private

Definition at line 1151 of file GuildHandler.cpp.

1152{
1153#if VERSION_STRING >= Cata
1154 uint8_t enable;
1155 recvPacket >> enable;
1156
1157 bool enabled = enable > 0 ? true : false;
1158
1159 if (enabled)
1160 _player->addPlayerFlags(PLAYER_FLAG_DECLINE_GUILD_INVITES);
1161 else
1162 _player->removePlayerFlags(PLAYER_FLAG_DECLINE_GUILD_INVITES);
1163#endif
1164}
void addPlayerFlags(uint32_t flags)
Definition Player.cpp:784
void removePlayerFlags(uint32_t flags)
Definition Player.cpp:785
Here is the call graph for this function:

◆ handleAutoEquipItemOpcode()

void WorldSession::handleAutoEquipItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 1207 of file ItemHandler.cpp.

1208{
1209 CmsgAutoequipItem srlPacket;
1210 if (!srlPacket.deserialise(recvPacket))
1211 return;
1212
1213 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUTOEQUIP_ITEM Inventory slot: {} Source Slot: {}", srlPacket.srcInventorySlot, srlPacket.srcSlot);
1214
1215 Item* eitem = _player->getItemInterface()->GetInventoryItem(srlPacket.srcInventorySlot, srlPacket.srcSlot);
1216
1217 if (eitem == nullptr)
1218 {
1220 return;
1221 }
1222
1224 if (Slot == ITEM_NO_SLOT_AVAILABLE)
1225 {
1227 return;
1228 }
1229
1230 int8_t error = 0;
1231
1232 // handle equipping of 2h when we have two items equipped! :) special case.
1233 if ((Slot == EQUIPMENT_SLOT_MAINHAND || Slot == EQUIPMENT_SLOT_OFFHAND)
1234 && !_player->canDualWield2H())
1235 {
1237 if (mainhandweapon != nullptr && mainhandweapon->getItemProperties()->InventoryType == INVTYPE_2HWEAPON)
1238 {
1241 {
1243 }
1244 }
1245 else
1246 {
1248 {
1250 }
1251 }
1252
1254 Slot, eitem->getItemProperties(), true, true);
1255 if (error)
1256 {
1257 _player->getItemInterface()->buildInventoryChangeError(eitem, nullptr, error);
1258 return;
1259 }
1260
1262 {
1263 // see if we have a weapon equipped in the offhand, if so we need to remove it
1265 if (offhandweapon != nullptr)
1266 {
1267 // we need to de-equip this
1269 if (!result.Result)
1270 {
1271 // no free slots for this item
1273 return;
1274 }
1275
1277 EQUIPMENT_SLOT_OFFHAND, false);
1278 if (offhandWeaponHolder == nullptr)
1279 return; // should never happen
1280
1281 // shouldn't happen either.
1282 auto [addResult, returnedItem] = _player->getItemInterface()->SafeAddItem(std::move(offhandWeaponHolder), result.ContainerSlot, result.Slot);
1283 if (!addResult)
1284 {
1285 // TODO: if add fails, should item be sent in mail? now it's destroyed
1286 _player->getItemInterface()->AddItemToFreeSlot(std::move(returnedItem));
1287 }
1288 }
1289 }
1290 else
1291 {
1292 // can't equip a non-two-handed weapon with a two-handed weapon
1294 if (mainhandweapon != nullptr && mainhandweapon->getItemProperties()->InventoryType == INVTYPE_2HWEAPON)
1295 {
1296 // we need to de-equip this
1298 if (!result.Result)
1299 {
1300 // no free slots for this item
1302 return;
1303 }
1304
1307 if (mainhandWeaponHolder == nullptr)
1308 return; // should never happen
1309
1310 // shouldn't happen either.
1311 auto [addResult, returnedItem] = _player->getItemInterface()->SafeAddItem(std::move(mainhandWeaponHolder), result.ContainerSlot, result.Slot);
1312 if (!addResult)
1313 {
1314 // TODO: if add fails, should item be sent in mail? now it's destroyed
1315 _player->getItemInterface()->AddItemToFreeSlot(std::move(returnedItem));
1316 }
1317 }
1318 }
1319 }
1320 else
1321 {
1323 Slot, eitem->getItemProperties(), false, false);
1324 if (error)
1325 {
1326 _player->getItemInterface()->buildInventoryChangeError(eitem, nullptr, error);
1327 return;
1328 }
1329 }
1330
1331 if (Slot <= INVENTORY_SLOT_BAG_END)
1332 {
1334 Slot, eitem->getItemProperties(), false, false);
1335 if (error)
1336 {
1337 _player->getItemInterface()->buildInventoryChangeError(eitem, nullptr, error);
1338 return;
1339 }
1340 }
1341
1343 {
1344 _player->getItemInterface()->SwapItemSlots(srlPacket.srcSlot, Slot);
1345 }
1346 else
1347 {
1348 auto eItemHolder = _player->getItemInterface()->SafeRemoveAndRetreiveItemFromSlot(srlPacket.srcInventorySlot, srlPacket.srcSlot, false);
1350 if (oitem != nullptr)
1351 {
1352 const auto [result, _] = _player->getItemInterface()->SafeAddItem(std::move(oitem), srlPacket.srcInventorySlot, srlPacket.srcSlot);
1353 if (!result)
1354 {
1355 // TODO: if add fails, should item be sent in mail? now it's destroyed
1356 sLogger.failure("Error while adding item to SrcSlot");
1357 }
1358 }
1359 if (eItemHolder != nullptr)
1360 {
1361 const auto [result, _] = _player->getItemInterface()->SafeAddItem(std::move(eItemHolder), INVENTORY_SLOT_NOT_SET, Slot);
1362 if (!result)
1363 {
1364 // TODO: if add fails, should item be sent in mail? now it's destroyed
1365 sLogger.failure("Error while adding item to Slot");
1366 return;
1367 }
1368 }
1369
1370 }
1371
1372 if (eitem != nullptr)
1373 {
1376#if VERSION_STRING > TBC
1377 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM,
1378 eitem->getItemProperties()->ItemId, 0, 0);
1379 // Achievement ID:556 description Equip an epic item in every slot with a minimum item level of 213.
1380 // "213" value not found in achievement or criteria entries, have to hard-code it here? :(
1381 // Achievement ID:557 description Equip a superior item in every slot with a minimum item level of 187.
1382 // "187" value not found in achievement or criteria entries, have to hard-code it here? :(
1383 if (eitem->getItemProperties()->Quality == ITEM_QUALITY_RARE_BLUE && eitem->getItemProperties()->ItemLevel >= 187 ||
1385 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, Slot,
1386 eitem->getItemProperties()->Quality, 0);
1387#endif
1388 }
1389 //Recalculate Expertise (for Weapon specs)
1391}
@ ITEM_QUALITY_EPIC_PURPLE
@ ITEM_QUALITY_RARE_BLUE
@ ITEM_FLAG_SOULBOUND
@ ITEM_BIND_ON_EQUIP
@ INV_ERR_ITEM_CANT_BE_EQUIPPED
@ INV_ERR_BAG_FULL
@ INVTYPE_WEAPON
@ INVTYPE_2HWEAPON
#define ITEM_NO_SLOT_AVAILABLE
SlotResult FindFreeInventorySlot(ItemProperties const *proto)
void SwapItemSlots(int8_t srcslot, int8_t dstslot)
Swap inventory slots.
int8_t CanEquipItemInSlot(int8_t DstInvSlot, int8_t slot, ItemProperties const *item, bool ignore_combat=false, bool skip_2h_check=false)
Checks if the item can be equipped on a specific slot.
int8_t GetItemSlotByType(uint32_t type)
void addFlags(uint32_t flags)
Definition Item.cpp:189
bool canDualWield2H() const
Definition Player.cpp:4261
void calcExpertise()
Definition Player.cpp:13192
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAutoEquipItemSlotOpcode()

void WorldSession::handleAutoEquipItemSlotOpcode ( WorldPacket recvPacket)
protected

Definition at line 1393 of file ItemHandler.cpp.

1394{
1395 CmsgAutoequipItemSlot srlPacket;
1396 if (!srlPacket.deserialise(recvPacket))
1397 return;
1398
1399 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUTOEQUIP_ITEM_SLOT");
1400
1401 int8_t srcSlot = static_cast<int8_t>(_player->getItemInterface()->GetInventorySlotByGuid(srlPacket.itemGuid));
1402 Item* item = _player->getItemInterface()->GetItemByGUID(srlPacket.itemGuid);
1403
1404 if (item == nullptr)
1405 return;
1406
1408 bool hasDualWield2H = false;
1409
1410 sLogger.debug("CMSG_AUTOEQUIP_ITEM_SLOT ItemGUID: {}, SrcSlot: {}, DestSlot: {}, SlotType: {}",
1411 srlPacket.itemGuid, srcSlot, srlPacket.destSlot, slotType);
1412
1413 if (srcSlot == srlPacket.destSlot)
1414 return;
1415
1416 if (_player->canDualWield2H() && (slotType == EQUIPMENT_SLOT_OFFHAND
1417 || slotType == EQUIPMENT_SLOT_MAINHAND))
1418 hasDualWield2H = true;
1419
1420 // Need to check if the item even goes into that slot
1421 // Item system is a mess too, so it needs rewrite, but hopefully this will do for now
1422 int8_t error = _player->getItemInterface()->CanEquipItemInSlot2(INVENTORY_SLOT_NOT_SET, srlPacket.destSlot, item);
1423 if (error)
1424 {
1425 _player->getItemInterface()->buildInventoryChangeError(item, nullptr, error);
1426 return;
1427 }
1428
1429 // Handle destination slot checking.
1430 if (srlPacket.destSlot == slotType || hasDualWield2H)
1431 {
1432 uint32_t invType = item->getItemProperties()->InventoryType;
1433 if (invType == INVTYPE_WEAPON || invType == INVTYPE_WEAPONMAINHAND ||
1434 invType == INVTYPE_WEAPONOFFHAND || invType == INVTYPE_2HWEAPON)
1435 {
1438
1439 if (mainHand != nullptr && offHand != nullptr && !_player->canDualWield2H())
1440 {
1441 // No DualWield2H like Titan's grip. Unequip offhand.
1443 if (!result.Result)
1444 {
1445 // No free slots for this item.
1447 return;
1448 }
1450 EQUIPMENT_SLOT_OFFHAND, false);
1451 // TODO: if add fails, should item be sent in mail? now it's destroyed
1452 _player->getItemInterface()->AddItemToFreeSlot(std::move(offHandHolder));
1453 _player->getItemInterface()->SwapItemSlots(srcSlot, srlPacket.destSlot); // Now swap Main hand with 2H weapon.
1454 }
1455 else
1456 {
1457 // Swap 2H with 2H or 2H with 1H if player has DualWield2H (ex: Titans Grip).
1458 _player->getItemInterface()->SwapItemSlots(srcSlot, srlPacket.destSlot);
1459 }
1460 }
1461 else if (srlPacket.destSlot == slotType)
1462 {
1463 // If item slot types match, swap.
1464 _player->getItemInterface()->SwapItemSlots(srcSlot, srlPacket.destSlot);
1465 }
1466 else
1467 {
1468 // Item slots do not match. We get here only for players who have DualWield2H (ex: Titans Grip).
1470 }
1471 }
1472 else
1473 {
1474 // Item slots do not match.
1476 }
1477}
@ INV_ERR_ITEM_DOESNT_GO_TO_SLOT
@ INVTYPE_WEAPONMAINHAND
@ INVTYPE_WEAPONOFFHAND
int16_t GetInventorySlotByGuid(uint64_t guid)
Gets slot number by item guid, banks not included.
int8_t CanEquipItemInSlot2(int8_t DstInvSlot, int8_t slot, Item *item, bool ignore_combat=false, bool skip_2h_check=false)
Checks if the item can be equipped on a specific slot this will check unique-equipped gems as well.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAutoStoreBagItemOpcode()

void WorldSession::handleAutoStoreBagItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 2457 of file ItemHandler.cpp.

2458{
2459 CmsgAutostoreBagItem srlPacket;
2460 if (!srlPacket.deserialise(recvPacket))
2461 return;
2462
2463 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUTOSTORE_BAG_ITEM");
2464
2465 Item* srcitem = _player->getItemInterface()->GetInventoryItem(srlPacket.srcContainerSlot, srlPacket.srcSlot);
2466
2467 //source item exists
2468 int8_t NewSlot = 0;
2469
2470 if (srcitem)
2471 {
2472 //src containers cant be moved if they have items inside
2473 if (srcitem->isContainer() && dynamic_cast<Container*>(srcitem)->hasItems())
2474 {
2476 return;
2477 }
2478 //check for destination now before swaping.
2479 //destination is backpack
2481 {
2482 //check for space
2484 if (NewSlot == ITEM_NO_SLOT_AVAILABLE)
2485 {
2487 return;
2488 }
2489 else
2490 {
2491 //free space found, remove item and add it to the destination
2493 srlPacket.srcSlot, false);
2494 if (srcItemHolder)
2495 {
2496 const auto [result, _] = _player->getItemInterface()->SafeAddItem(std::move(srcItemHolder), INVENTORY_SLOT_NOT_SET, NewSlot);
2497 if (!result)
2498 {
2499 // TODO: if add fails, should item be sent in mail? now it's destroyed
2500 sLogger.failure("Error while adding item to newslot");
2501 return;
2502 }
2503 }
2504 }
2505 }
2506 else
2507 {
2508 const int8_t error = _player->getItemInterface()->CanEquipItemInSlot2(srlPacket.dstContainerSlot,
2509 srlPacket.dstContainerSlot, srcitem);
2510 if (error != 0)
2511 {
2513 {
2514 _player->getItemInterface()->buildInventoryChangeError(srcitem, nullptr, error);
2515 return;
2516 }
2517 }
2518
2519 //destination is a bag
2520 if (Item* dstitem = _player->getItemInterface()->GetInventoryItem(srlPacket.dstContainerSlot))
2521 {
2522 //dstitem exists, detect if its a container
2523 if (dstitem->isContainer())
2524 {
2525 NewSlot = dynamic_cast<Container*>(dstitem)->findFreeSlot();
2526 if (NewSlot == ITEM_NO_SLOT_AVAILABLE)
2527 {
2529 return;
2530 }
2531 else
2532 {
2534 srlPacket.srcSlot, false);
2535 if (srcItemHolder != nullptr)
2536 {
2537 const auto [result, _] = _player->getItemInterface()->SafeAddItem(std::move(srcItemHolder), srlPacket.dstContainerSlot, NewSlot);
2538 if (!result)
2539 {
2540 // TODO: if add fails, should item be sent in mail? now it's destroyed
2541 sLogger.failure("Error while adding item to newslot");
2542 }
2543 }
2544 }
2545 }
2546 else
2547 {
2549 }
2550 }
2551 else
2552 {
2554 }
2555 }
2556 }
2557 else
2558 {
2560 }
2561}
@ INV_ERR_NONEMPTY_BAG_OVER_OTHER_BAG
#define INVENTORY_KEYRING_END
bool hasItems() const
int8_t FindFreeBackPackSlot()
Finds a free slot on the backpack.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAutoStoreBankItemOpcode()

void WorldSession::handleAutoStoreBankItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 2693 of file ItemHandler.cpp.

2694{
2695 CmsgAutostoreBankItem srlPacket;
2696 if (!srlPacket.deserialise(recvPacket))
2697 return;
2698
2699 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUTOSTORE_BANK_ITEM Inventory slot: {} Source Slot: {}",
2700 static_cast<uint32_t>(srlPacket.srcInventorySlot), static_cast<uint32_t>(srlPacket.srcSlot));
2701
2702 Item* eitem = _player->getItemInterface()->GetInventoryItem(srlPacket.srcInventorySlot, srlPacket.srcSlot);
2703 if (!eitem)
2704 {
2706 return;
2707 }
2708
2710 if (!slotresult.Result)
2711 {
2713 }
2714 else
2715 {
2717 srlPacket.srcSlot, false);
2718 if (itemHolder == nullptr)
2719 return;
2720
2721 auto [result, returnedItem] = _player->getItemInterface()->AddItemToFreeSlot(std::move(itemHolder));
2722 if (!result)
2723 {
2724 sLogger.failure("Error while adding item from one of the bank bags to the player bag!");
2725 // TODO: if add fails, should item be sent in mail? now it's destroyed
2726 _player->getItemInterface()->SafeAddItem(std::move(returnedItem), srlPacket.srcInventorySlot, srlPacket.srcSlot);
2727 }
2728 }
2729}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleAutostoreLootItemOpcode()

void WorldSession::handleAutostoreLootItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 78 of file LootHandler.cpp.

79{
80 CmsgAutostoreLootItem srlPacket;
81 if (!srlPacket.deserialise(recvPacket))
82 return;
83
85
86 GameObject* lootGameObject = nullptr;
87 Creature* lootCreature = nullptr;
88 Item* lootItem = nullptr;
89
90 WoWGuid wowGuid;
91 wowGuid.Init(_player->getLootGuid());
92
93 auto loot = getItemLootFromHighGuidType(wowGuid);
94 if (loot == nullptr)
95 return;
96
97 if (wowGuid.isUnit())
98 {
99 lootCreature = _player->getWorldMap()->getCreature(wowGuid.getGuidLowPart());
100 if (lootCreature == nullptr)
101 return;
102 }
103 else if (wowGuid.isGameObject())
104 {
105 lootGameObject = _player->getWorldMap()->getGameObject(wowGuid.getGuidLowPart());
106 if (lootGameObject == nullptr)
107 return;
108 }
109 else if (wowGuid.isItem())
110 {
111 lootItem = _player->getItemInterface()->GetItemByGUID(wowGuid.getRawGuid());
112 if (lootItem == nullptr)
113 return;
114 }
115 else if (wowGuid.isPlayer())
116 {
117 const auto player = _player->getWorldMap()->getPlayer(wowGuid.getGuidLowPart());
118 if (player == nullptr)
119 return;
120 }
121
122 // Add item
123 auto item = _player->storeNewLootItem(srlPacket.slot, loot);
124
125 if (!item)
126 return;
127
128 ItemProperties const* proto = sMySQLStore.getItemProperties(item->getEntry());
129
130 if (lootGameObject)
131 {
132 if (lootGameObject->GetScript())
133 lootGameObject->GetScript()->OnLootTaken(_player, proto);
134 }
135 else if (lootCreature)
136 {
137 if (lootCreature->IsInWorld() && lootCreature->isCreature() && lootCreature->GetScript())
138 lootCreature->GetScript()->OnLootTaken(_player, proto);
139 }
140
141 sHookInterface.OnLoot(_player, lootCreature, 0, item->getEntry());
142
143 if (lootGameObject && lootGameObject->getEntry() == GO_FISHING_BOBBER)
144 {
145 int count = 0;
146 for (const auto& itemFromLoot : loot->items)
147 count += itemFromLoot.count;
148
149 if (!count)
150 lootGameObject->expireAndDelete();
151 }
152
153 if (loot->isLooted() && wowGuid.isItem())
154 _player->getSession()->doLootRelease(wowGuid);
155}
#define GO_FISHING_BOBBER
Definition LootMacros.hpp:8
virtual void OnLootTaken(Player *, ItemProperties const *)
CreatureAIScript * GetScript()
virtual void OnLootTaken(Player *, ItemProperties const *)
GameObjectAIScript * GetScript()
void expireAndDelete()
void interruptSpell(uint32_t spellId=0, bool checkMeleeSpell=true)
Definition Object.cpp:701
uint32_t getEntry() const
Definition Object.cpp:382
bool isCreature() const
Definition Object.cpp:570
Item * storeNewLootItem(uint8_t slot, Loot *loot)
Definition Player.cpp:11163
const uint64_t & getLootGuid() const
Definition Player.cpp:10787
bool isUnit() const
Definition WoWGuid.h:299
void doLootRelease(WoWGuid lguid)
Loot * getItemLootFromHighGuidType(WoWGuid wowGuid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBankerActivateOpcode()

void WorldSession::handleBankerActivateOpcode ( WorldPacket recvPacket)
protected

Definition at line 77 of file NPCHandler.cpp.

78{
79 CmsgBankerActivate srlPacket;
80 if (!srlPacket.deserialise(recvPacket))
81 return;
82
83 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_BANKER_ACTIVATE: {} (guidLowPart)", srlPacket.guid.getGuidLowPart());
84
85 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
86 if (creature == nullptr)
87 return;
88
89 SendPacket(SmsgShowBank(srlPacket.guid).serialise().get());
90}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBarberShopResult()

void WorldSession::handleBarberShopResult ( WorldPacket recvPacket)
protected

Definition at line 1637 of file MiscHandler.cpp.

1638{
1639#if VERSION_STRING > TBC
1640 // todo: Here was SMSG_BARBER_SHOP:RESULT... maybe itr is MSG or it was just wrong. Check it!
1641 CmsgAlterAppearance srlPacket;
1642 if (!srlPacket.deserialise(recvPacket))
1643 return;
1644
1645 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_ALTER_APPEARANCE");
1646
1647 const uint32_t oldHair = _player->getHairStyle();
1648 const uint32_t oldHairColor = _player->getHairColor();
1649 const uint32_t oldFacial = _player->getFacialFeatures();
1650
1651 uint32_t cost = 0;
1652
1653 const auto barberShopHair = sBarberShopStyleStore.lookupEntry(srlPacket.hair);
1654 if (!barberShopHair)
1655 return;
1656
1657 const auto newHair = barberShopHair->hair_id;
1658
1659 const auto newHairColor = srlPacket.hairColor;
1660
1661 const auto barberShopFacial = sBarberShopStyleStore.lookupEntry(srlPacket.facialHairOrPiercing);
1662 if (!barberShopFacial)
1663 return;
1664
1665 const auto newFacial = barberShopFacial->hair_id;
1666
1667 const auto barberShopSkinColor = sBarberShopStyleStore.lookupEntry(srlPacket.skinColor);
1668 if (barberShopSkinColor && barberShopSkinColor->race != _player->getRace())
1669 return;
1670
1671 auto level = _player->getLevel();
1672 if (level >= 100)
1673 level = 100;
1674
1675 const auto gtBarberShopCostBaseEntry = sBarberShopCostBaseStore.lookupEntry(level - 1);
1676 if (!gtBarberShopCostBaseEntry)
1677 return;
1678
1679 if (newHair != oldHair)
1680 cost += static_cast<uint32_t>(gtBarberShopCostBaseEntry->cost);
1681 else if (newHairColor != oldHairColor)
1682 cost += static_cast<uint32_t>(gtBarberShopCostBaseEntry->cost) >> 1;
1683
1684 if (newFacial != oldFacial)
1685 cost += static_cast<uint32_t>(gtBarberShopCostBaseEntry->cost * 0.75f);
1686
1687 if (!_player->hasEnoughCoinage(cost))
1688 {
1689 SendPacket(SmsgBarberShopResult(BarberShopResult::NoMoney).serialise().get());
1690 return;
1691 }
1692
1693 SendPacket(SmsgBarberShopResult(BarberShopResult::Ok).serialise().get());
1694
1695 _player->setHairStyle(static_cast<uint8_t>(newHair));
1696 _player->setHairColor(static_cast<uint8_t>(newHairColor));
1697 _player->setFacialFeatures(static_cast<uint8_t>(newFacial));
1698 if (barberShopSkinColor)
1699 _player->setSkinColor(static_cast<uint8_t>(barberShopSkinColor->hair_id));
1700
1701 _player->modCoinage(-static_cast<int32_t>(cost));
1702
1704 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_VISIT_BARBER_SHOP, 1, 0, 0);
1705 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_AT_BARBER, cost, 0, 0);
1706#endif
1707}
@ STANDSTATE_STAND
SERVER_DECL WDB::WDBContainer< WDB::Structures::GtBarberShopCostBaseEntry > sBarberShopCostBaseStore
SERVER_DECL WDB::WDBContainer< WDB::Structures::BarberShopStyleEntry > sBarberShopStyleStore
uint8_t getHairColor() const
Definition Player.cpp:833
void setHairColor(uint8_t color)
Definition Player.cpp:834
uint8_t getHairStyle() const
Definition Player.cpp:830
void setHairStyle(uint8_t style)
Definition Player.cpp:831
uint8_t getFacialFeatures() const
Definition Player.cpp:841
void setSkinColor(uint8_t color)
Definition Player.cpp:825
void setFacialFeatures(uint8_t feature)
Definition Player.cpp:842
void setStandState(uint8_t standState)
Definition Unit.cpp:1366
uint8_t getRace() const
Definition Unit.cpp:453
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBattlefieldListOpcode()

void WorldSession::handleBattlefieldListOpcode ( WorldPacket recvPacket)
protected

Definition at line 140 of file BattlegroundHandler.cpp.

141{
142 CmsgBattlefieldList srlPacket;
143 if (!srlPacket.deserialise(recvPacket))
144 return;
145
146 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_BATTLEFIELD_LIST: {} (bgType), {} (fromType)", srlPacket.bgType, srlPacket.fromType);
147
148#if VERSION_STRING <= WotLK
149 sBattlegroundManager.handleBattlegroundListPacket(this, srlPacket.bgType, srlPacket.fromType);
150 #else
151 WoWGuid guid;
152 guid.Init(uint64_t(0));
153 sBattlegroundManager.handleBattlegroundListPacket(guid, this, srlPacket.bgType);
154#endif
155}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBattlefieldPortOpcode()

void WorldSession::handleBattlefieldPortOpcode ( WorldPacket recvPacket)
protected

Definition at line 117 of file BattlegroundHandler.cpp.

118{
119 CmsgBattlefieldPort srlPacket;
120 if (!srlPacket.deserialise(recvPacket))
121 return;
122
123 if (srlPacket.action != 0)
124 {
127 }
128 else
129 {
130 sBattlegroundManager.removePlayerFromQueues(_player);
131 }
132}
void portPlayer(Player *plr, bool skip_teleport=false)
Battleground * m_pendingBattleground
Definition Player.hpp:1456
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBattlefieldStatusOpcode()

void WorldSession::handleBattlefieldStatusOpcode ( WorldPacket )
protected

Definition at line 236 of file BattlegroundHandler.cpp.

237{
238 const auto pendingBattleground = _player->m_pendingBattleground;
239 const auto Battleground = _player->m_bg;
240
241 if (Battleground)
243 else if (pendingBattleground)
244 sBattlegroundManager.sendBattlefieldStatus(_player, BattlegroundDef::STATUS_READY, pendingBattleground->getType(), pendingBattleground->getId(), 120000, 0, pendingBattleground->Rated());
245 else
246 sBattlegroundManager.sendBattlefieldStatus(_player, BattlegroundDef::STATUS_NOFLAGS, 0, 0, 0, 0, 0);
247}
uint32_t getId()
uint32_t getType()
virtual uint8_t Rated()
uint32_t getStartTime()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBattlegroundPlayerPositionsOpcode()

void WorldSession::handleBattlegroundPlayerPositionsOpcode ( WorldPacket )
protected

Definition at line 172 of file BattlegroundHandler.cpp.

173{
174 const auto Battleground = _player->m_bg;
175 if (Battleground == nullptr)
176 return;
177
178 uint32_t flagHolders = 0;
179
180 const auto alliancePlayer = sObjectMgr.getPlayer(static_cast<uint32_t>(Battleground->GetFlagHolderGUID(TEAM_ALLIANCE)));
181 if (alliancePlayer)
182 ++flagHolders;
183
184 const auto hordePlayer = sObjectMgr.getPlayer(static_cast<uint32_t>(Battleground->GetFlagHolderGUID(TEAM_HORDE)));
185 if (hordePlayer)
186 ++flagHolders;
187
188 SendPacket(MsgBattlegroundPlayerPosition(0, flagHolders, alliancePlayer, hordePlayer).serialise().get());
189}
@ TEAM_ALLIANCE
@ TEAM_HORDE
virtual uint64_t GetFlagHolderGUID(uint32_t faction) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBattleMasterHelloOpcode()

void WorldSession::handleBattleMasterHelloOpcode ( WorldPacket recvPacket)
protected

Definition at line 157 of file BattlegroundHandler.cpp.

158{
159 CmsgBattlemasterHello srlPacket;
160 if (!srlPacket.deserialise(recvPacket))
161 return;
162
163 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_BATTLEMASTER_HELLO: {} (guidLowPart)", srlPacket.guid.getGuidLowPart());
164
165 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
166 if (creature == nullptr || !creature->isBattleMaster())
167 return;
168
169 sendBattlegroundList(creature, 0);
170}
void sendBattlegroundList(Creature *creature, uint32_t mapId)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBattleMasterJoinOpcode()

void WorldSession::handleBattleMasterJoinOpcode ( WorldPacket recvPacket)
protected

Definition at line 249 of file BattlegroundHandler.cpp.

250{
252 {
254 data << uint32_t(0xFFFFFFFE);
255 _player->getSession()->SendPacket(&data);
256 return;
257 }
258
260 {
261 SystemMessage("You are already in a group and queued for a battleground or inside a battleground. Leave this first.");
262 return;
263 }
264
266 sBattlegroundManager.removePlayerFromQueues(_player);
267
268 if (_player->IsInWorld())
269 sBattlegroundManager.handleBattlegroundJoin(this, recvPacket);
270}
@ SMSG_GROUP_JOINED_BATTLEGROUND
Definition Opcodes.hpp:814
bool hasAurasWithId(uint32_t auraId) const
Definition Unit.cpp:5004
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBeginTradeOpcode()

void WorldSession::handleBeginTradeOpcode ( WorldPacket )
protected

Definition at line 160 of file TradeHandler.cpp.

161{
162 const auto tradeData = _player->getTradeData();
163 if (tradeData == nullptr)
164 {
166 return;
167 }
168
169 if (_player->CalcDistance(tradeData->getTradeTarget()) > 10.0f)
170 {
172 return;
173 }
174
176 tradeData->getTradeTarget()->getSession()->sendTradeResult(TRADE_STATUS_INITIATED);
177}
@ TRADE_STATUS_PLAYER_NOT_FOUND
@ TRADE_STATUS_INITIATED
@ TRADE_STATUS_TOO_FAR_AWAY
float CalcDistance(Object *Ob)
Definition Object.cpp:3555
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBinderActivateOpcode()

void WorldSession::handleBinderActivateOpcode ( WorldPacket recvPacket)
protected

Definition at line 307 of file NPCHandler.cpp.

308{
309 CmsgBinderActivate srlPacket;
310 if (!srlPacket.deserialise(recvPacket))
311 return;
312
313 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_BINDER_ACTIVATE: {} (guidLowPart)", srlPacket.guid.getGuidLowPart());
314
315 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
316 if (creature == nullptr)
317 return;
318
319 sendInnkeeperBind(creature);
320}
void sendInnkeeperBind(Creature *creature)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBugOpcode()

void WorldSession::handleBugOpcode ( WorldPacket recvPacket)
protected

Definition at line 969 of file MiscHandler.cpp.

970{
971 uint8_t unk1;
972 uint8_t unk2;
973
974 recv_data >> unk1;
975 recv_data >> unk2;
976
977 uint32_t lenght = 0;
978 lenght = unk1 * 16;
979 lenght += unk2 / 16;
980
981 std::string bugMessage;
982 bugMessage = recv_data.ReadString(lenght);
983
984 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_BUG [Bug Report] lenght: {} message: {}", lenght, bugMessage);
985
986 uint64_t accountId = GetAccountId();
987 uint32_t timeStamp = uint32_t(UNIXTIME);
988 uint32_t reportId = sObjectMgr.generateReportId();
989
990 std::stringstream ss;
991
992 ss << "INSERT INTO playerbugreports VALUES('";
993 ss << reportId << "','";
994 ss << accountId << "','";
995 ss << timeStamp << "',";
996 ss << "'0',";
997 ss << "'0','";
998 ss << CharacterDatabase.EscapeString(bugMessage) << "')";
999
1000 CharacterDatabase.ExecuteNA(ss.str().c_str());
1001}
uint32_t GetAccountId() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBusyTrade()

void WorldSession::handleBusyTrade ( WorldPacket )
protected

Definition at line 566 of file TradeHandler.cpp.

567{
568#if VERSION_STRING < Cata
569 const auto tradeData = _player->getTradeData();
570 if (tradeData == nullptr)
571 {
573 return;
574 }
575
577 tradeData->getTradeTarget()->getSession()->sendTradeResult(TRADE_STATUS_PLAYER_BUSY);
578
579 _player->cancelTrade(false, true);
580#endif
581}
@ TRADE_STATUS_PLAYER_BUSY
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBuyBackOpcode()

void WorldSession::handleBuyBackOpcode ( WorldPacket recvPacket)
protected

Definition at line 1773 of file ItemHandler.cpp.

1774{
1775 CmsgBuyBackItem srlPacket;
1776 if (!srlPacket.deserialise(recvPacket))
1777 return;
1778
1779 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_BUY_BACK_ITEM");
1780
1781 srlPacket.buybackSlot -= 74;
1782
1783 if (Item* it = _player->getItemInterface()->GetBuyBack(srlPacket.buybackSlot))
1784 {
1785 // Find free slot and break if inv full
1786 uint32_t amount = it->getStackCount();
1787 uint32_t itemid = it->getEntry();
1788
1789 Item* add = _player->getItemInterface()->FindItemLessMax(itemid, amount, false);
1790
1791 uint32_t FreeSlots = _player->getItemInterface()->CalculateFreeSlots(it->getItemProperties());
1792 if (FreeSlots == 0 && !add)
1793 {
1795 return;
1796 }
1797
1798 // Check for gold
1799 uint32_t cost = _player->getBuybackPriceSlot(srlPacket.buybackSlot);
1800 if (!_player->hasEnoughCoinage(cost))
1801 {
1802 sendBuyFailed(srlPacket.buybackSlot, itemid, 2);
1803 return;
1804 }
1805
1806 uint8_t error;
1807
1808 // Check for item uniqueness
1809 if ((error = _player->getItemInterface()->CanReceiveItem(it->getItemProperties(), amount)) != 0)
1810 {
1811 _player->getItemInterface()->buildInventoryChangeError(nullptr, nullptr, error, itemid);
1812 return;
1813 }
1814
1815 int32_t coins = cost * -1;
1816 _player->modCoinage(coins);
1817 auto itemHolder = _player->getItemInterface()->RemoveBuyBackItem(srlPacket.buybackSlot);
1818
1819 if (!add)
1820 {
1821 it->m_isDirty = true; // save the item again on logout
1822 const auto [result, _] = _player->getItemInterface()->AddItemToFreeSlot(std::move(itemHolder));
1823 if (!result)
1824 {
1825 // TODO: if add fails, should item be sent in mail? now it's destroyed
1826 sLogger.failure("Error while adding item to free slot");
1827 }
1828 }
1829 else
1830 {
1831 add->setStackCount(add->getStackCount() + amount);
1832 add->m_isDirty = true;
1833
1834 // delete the item
1835 it->deleteFromDB();
1836 }
1837
1838#if VERSION_STRING < Cata
1839 WorldPacket data(16);
1840 data.Initialize(SMSG_BUY_ITEM);
1841 data << uint64_t(srlPacket.itemGuid);
1842 data << Util::getMSTime(); //VLack: seen is Aspire code
1843 data << uint32_t(itemid);
1844 data << uint32_t(amount);
1845#else
1846 WorldPacket data(SMSG_BUY_ITEM, 8 + 4 + 4 + 4);
1847 data << uint64_t(srlPacket.itemGuid);
1848 data << uint32_t(srlPacket.buybackSlot + 1);// numbered from 1 at client
1849 data << int32_t(amount);
1850 data << uint32_t(amount);
1851 data << uint32_t(amount);
1852#endif
1853 SendPacket(&data);
1854 }
1855}
@ SMSG_BUY_ITEM
Definition Opcodes.hpp:465
Item * GetBuyBack(int32_t slot)
int8_t CanReceiveItem(ItemProperties const *item, uint32_t amount)
Checks if player can receive the item.
std::unique_ptr< Item > RemoveBuyBackItem(uint8_t index)
Item * FindItemLessMax(uint32_t itemid, uint32_t cnt, bool IncBank)
Checks for stacks that didn't reached max capacity.
void setStackCount(uint32_t count)
Definition Item.cpp:144
bool m_isDirty
Definition Item.hpp:258
uint32_t getBuybackPriceSlot(uint8_t slot) const
Definition Player.cpp:1242
void sendBuyFailed(uint64_t guid, uint32_t itemid, uint8_t error)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBuyBankSlotOpcode()

void WorldSession::handleBuyBankSlotOpcode ( WorldPacket recvPacket)
protected

Definition at line 690 of file NPCHandler.cpp.

691{
692 CmsgBuyBankSlot srlPacket;
693 if (!srlPacket.deserialise(recvPacket))
694 return;
695
696 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_BUY_BANK_SLOT: {} (guidLow)", srlPacket.guid.getGuidLow());
697
698 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
699 if (creature == nullptr || !creature->isBanker())
700 {
702 return;
703 }
704
705 const uint8_t slots = _player->getBankSlots() + 1U;
706 const auto bank_bag_slot_prices = sBankBagSlotPricesStore.lookupEntry(slots);
707 if (bank_bag_slot_prices == nullptr)
708 {
710 return;
711 }
712
713 const auto price = bank_bag_slot_prices->Price;
714 if (!_player->hasEnoughCoinage(price))
715 {
717 return;
718 }
719
720 _player->setBankSlots(slots);
721 _player->modCoinage(-static_cast<int32_t>(price));
722#if VERSION_STRING > TBC
723 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT, 1, 0, 0);
724#endif
725
726}
SERVER_DECL WDB::WDBContainer< WDB::Structures::BankBagSlotPrices > sBankBagSlotPricesStore
Definition WDBStores.cpp:59
uint8_t getBankSlots() const
Definition Player.cpp:844
void setBankSlots(uint8_t slots)
Definition Player.cpp:845
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBuyItemInSlotOpcode()

void WorldSession::handleBuyItemInSlotOpcode ( WorldPacket recvPacket)
protected

Definition at line 1949 of file ItemHandler.cpp.

1950{
1951 CmsgBuyItemInSlot srlPacket;
1952 if (!srlPacket.deserialise(recvPacket))
1953 return;
1954
1955 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_BUY_ITEM_IN_SLOT");
1956
1957 int8_t slot = srlPacket.slot;
1958 uint8_t amount = srlPacket.amount;
1959
1960 uint8_t error;
1961 int8_t bagslot = INVENTORY_SLOT_NOT_SET;
1962
1963 if (amount < 1)
1964 amount = 1;
1965
1967
1969 if (unit == nullptr || !unit->HasItems())
1970 return;
1971
1972 CreatureItem ci{};
1973 unit->GetSellItemByItemId(srlPacket.itemId, ci);
1974
1975 if (ci.itemid == 0)
1976 return;
1977
1978 if (ci.max_amount > 0 && ci.available_amount < amount)
1979 {
1981 return;
1982 }
1983
1984 ItemProperties const* it = sMySQLStore.getItemProperties(srlPacket.itemId);
1985 if (it == nullptr)
1986 return;
1987
1988 uint32_t itemMaxStack = _player->m_cheats.hasItemStackCheat ? 0x7fffffff : it->MaxCount;
1989 if (itemMaxStack > 0 && ci.amount * amount > itemMaxStack)
1990 {
1992 return;
1993 }
1994
1995 uint32_t count_per_stack = ci.amount * amount;
1996
1997 // if slot is different than -1, check for validation, else continue for auto storing.
1998 if (slot != INVENTORY_SLOT_NOT_SET)
1999 {
2000 if (!(srlPacket.bagGuid >> 32))//buy to backpack
2001 {
2003 {
2004 //hackers!
2006 return;
2007 }
2008 }
2009 else
2010 {
2011 Container* c = dynamic_cast<Container*>(_player->getItemInterface()->GetItemByGUID(srlPacket.bagGuid));
2012 if (!c)
2013 return;
2014 bagslot = static_cast<int8_t>(_player->getItemInterface()->GetBagSlotByGuid(srlPacket.bagGuid));
2015
2016 if (bagslot == INVENTORY_SLOT_NOT_SET || static_cast<uint32_t>(slot) > c->getItemProperties()->ContainerSlots)
2017 {
2019 return;
2020 }
2021 }
2022 }
2023 else
2024 {
2025 if (srlPacket.bagGuid >> 32)
2026 {
2027 Container* c = dynamic_cast<Container*>(_player->getItemInterface()->GetItemByGUID(srlPacket.bagGuid));
2028 if (!c)
2029 {
2031 return;//non empty
2032 }
2033
2034 bagslot = static_cast<int8_t>(_player->getItemInterface()->GetBagSlotByGuid(srlPacket.bagGuid));
2035 slot = c->findFreeSlot();
2036 }
2037 else
2039 }
2040
2041 if ((error = _player->getItemInterface()->CanReceiveItem(it, amount)) != 0)
2042 {
2043 _player->getItemInterface()->buildInventoryChangeError(nullptr, nullptr, error, srlPacket.itemId);
2044 return;
2045 }
2046
2047 if ((error = _player->getItemInterface()->CanAffordItem(it, amount, unit)) != 0)
2048 {
2049 _player->getItemInterface()->buildInventoryChangeError(nullptr, nullptr, error, srlPacket.itemId);
2050 return;
2051 }
2052
2053 if (slot == INVENTORY_SLOT_NOT_SET)
2054 {
2056 return;
2057 }
2058
2059 // ok our z and slot are set.
2060 Item* oldItem = _player->getItemInterface()->GetInventoryItem(bagslot, slot);
2061 Item* pItem;
2062
2063 if (oldItem != nullptr)
2064 {
2065 // try to add to the existing items stack
2066 if (oldItem->getItemProperties() != it)
2067 {
2069 return;
2070 }
2071
2072 if (oldItem->getStackCount() + count_per_stack > itemMaxStack)
2073 {
2075 return;
2076 }
2077
2078 oldItem->modStackCount(count_per_stack);
2079 oldItem->m_isDirty = true;
2080 pItem = oldItem;
2081 }
2082 else
2083 {
2084 auto itemHolder = sObjectMgr.createItem(it->ItemId, _player);
2085 if (itemHolder)
2086 {
2087 itemHolder->setStackCount(count_per_stack);
2088 itemHolder->m_isDirty = true;
2089 pItem = itemHolder.get();
2090 const auto [result, returnedItem] = _player->getItemInterface()->SafeAddItem(std::move(itemHolder), bagslot, slot);
2091 if (!result)
2092 {
2093 // TODO: if add fails, should item be sent in mail? now it's destroyed
2094 return;
2095 }
2096 }
2097 else
2098 return;
2099 }
2100
2101 _player->sendItemPushResultPacket(false, true, false, bagslot, pItem != oldItem ? slot : 0,
2102 amount * ci.amount, pItem->getEntry(), pItem->getPropertySeed(),
2103 pItem->getRandomPropertiesId(), pItem->getStackCount());
2104
2105 WorldPacket data(SMSG_BUY_ITEM, 22);
2106 data << uint64_t(srlPacket.srcGuid.getRawGuid());
2107#if VERSION_STRING < Cata
2108 data << Util::getMSTime();
2109 data << uint32_t(srlPacket.itemId);
2110#else
2111 data << uint32_t(slot + 1); // numbered from 1 at client
2112 data << int32_t(amount);
2113#endif
2114 data << uint32_t(amount);
2115
2116 SendPacket(&data);
2117
2118 sLogger.debug("Sent SMSG_BUY_ITEM");
2119
2120 _player->getItemInterface()->BuyItem(it, amount, unit);
2121 if (ci.max_amount)
2122 {
2123 unit->ModAvItemAmount(ci.itemid, ci.amount * amount);
2124
2125 // there is probably a proper opcode for this. - burlex
2126 sendInventoryList(unit);
2127 }
2128}
@ INVENTORY_SLOT_ITEM_START
@ INVENTORY_SLOT_ITEM_END
@ INV_ERR_ITEM_IS_CURRENTLY_SOLD_OUT
@ INV_ERR_CANT_CARRY_MORE_OF_THIS
int8_t findFreeSlot()
void ModAvItemAmount(uint32_t itemid, uint32_t value)
void GetSellItemByItemId(uint32_t itemid, CreatureItem &ci)
bool HasItems()
int16_t GetBagSlotByGuid(uint64_t guid)
int8_t CanAffordItem(ItemProperties const *item, uint32_t amount, Creature *pVendor)
void BuyItem(ItemProperties const *item, uint32_t total_amount, Creature *pVendor)
void modStackCount(int32_t mod)
Definition Item.cpp:145
PlayerCheat m_cheats
Definition Player.hpp:1090
void sendItemPushResultPacket(bool created, bool recieved, bool sendtoset, uint8_t destbagslot, uint32_t destslot, uint32_t count, uint32_t entry, uint32_t suffix, uint32_t randomprop, uint32_t stack)
Definition Player.cpp:9724
void sendInventoryList(Creature *pCreature)
uint32_t ContainerSlots
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBuyItemOpcode()

void WorldSession::handleBuyItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 2130 of file ItemHandler.cpp.

2131{
2132 CmsgBuyItem srlPacket;
2133 if (!srlPacket.deserialise(recvPacket))
2134 return;
2135
2136 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_BUY_ITEM");
2137
2138 uint8_t error = 0;
2139 SlotResult slotResult;
2140
2141 auto creature = _player->getWorldMap()->getCreature(srlPacket.sourceGuid.getGuidLowPart());
2142 if (creature == nullptr || !creature->HasItems())
2143 return;
2144
2145 auto item_extended_cost = creature->GetItemExtendedCostByItemId(srlPacket.itemEntry);
2146
2147 if (srlPacket.amount < 1)
2148 srlPacket.amount = 1;
2149
2150 CreatureItem creature_item{};
2151 creature->GetSellItemByItemId(srlPacket.itemEntry, creature_item);
2152
2153 if (creature_item.itemid == 0)
2154 {
2155 // vendor does not sell this item.. bitch about cheaters?
2157 return;
2158 }
2159
2160 if (creature_item.max_amount > 0 && creature_item.available_amount < srlPacket.amount)
2161 {
2163 return;
2164 }
2165
2166 ItemProperties const* it = sMySQLStore.getItemProperties(srlPacket.itemEntry);
2167 if (!it)
2168 {
2170 return;
2171 }
2172
2173 uint32_t itemMaxStack = _player->m_cheats.hasItemStackCheat ? 0x7fffffff : it->MaxCount;
2174 if (itemMaxStack > 0 && srlPacket.amount * creature_item.amount > itemMaxStack)
2175 {
2177 return;
2178 }
2179
2180 if ((error = _player->getItemInterface()->CanReceiveItem(it, srlPacket.amount * creature_item.amount)) != 0)
2181 {
2182 _player->getItemInterface()->buildInventoryChangeError(nullptr, nullptr, error, srlPacket.itemEntry);
2183 return;
2184 }
2185
2186 if ((error = _player->getItemInterface()->CanAffordItem(it, srlPacket.amount, creature)) != 0)
2187 {
2188 _player->getItemInterface()->buildInventoryChangeError(nullptr, nullptr, error, srlPacket.itemEntry);
2189 return;
2190 }
2191
2192 // Find free slot and break if inv full
2193 auto addItem = _player->getItemInterface()->FindItemLessMax(srlPacket.itemEntry,
2194 srlPacket.amount * creature_item.amount, false);
2195
2196 if (!addItem)
2197 {
2198 slotResult = _player->getItemInterface()->FindFreeInventorySlot(it);
2199 }
2200
2201 if (!slotResult.Result && !addItem)
2202 {
2203 //Player doesn't have a free slot in his/her bag(s)
2205 return;
2206 }
2207
2208 if (!addItem)
2209 {
2210 auto itemHolder = sObjectMgr.createItem(creature_item.itemid, _player);
2211 if (!itemHolder)
2212 {
2214 return;
2215 }
2216
2217 itemHolder->m_isDirty = true;
2218 itemHolder->setStackCount(srlPacket.amount * creature_item.amount);
2219
2220 if (slotResult.ContainerSlot == ITEM_NO_SLOT_AVAILABLE)
2221 {
2222 auto* item = itemHolder.get();
2223 // TODO: if add fails, should item be sent in mail? now it's destroyed
2224 const auto [addItemResult, _] = _player->getItemInterface()->SafeAddItem(std::move(itemHolder), INVENTORY_SLOT_NOT_SET, slotResult.Slot);
2225 if (addItemResult == ADD_ITEM_RESULT_OK)
2226 {
2227 if (item->isEligibleForRefund() && item_extended_cost != nullptr)
2228 {
2229 item->getOwner()->getItemInterface()->AddRefundable(item->getGuid(), item_extended_cost->costid);
2230 }
2231 _player->sendItemPushResultPacket(false, true, false, static_cast<uint8_t>(INVENTORY_SLOT_NOT_SET),
2232 slotResult.Result, srlPacket.amount * creature_item.amount, item->getEntry(), item->getPropertySeed(),
2233 item->getRandomPropertiesId(), item->getStackCount());
2234 }
2235 }
2236 else
2237 {
2238 if (Item* bag = _player->getItemInterface()->GetInventoryItem(slotResult.ContainerSlot))
2239 {
2240 auto* item = itemHolder.get();
2241 // TODO: if add fails, should item be sent in mail? now it's destroyed
2242 const auto [addItemResult, _] = dynamic_cast<Container*>(bag)->addItem(slotResult.Slot, std::move(itemHolder));
2243 if (addItemResult == ADD_ITEM_RESULT_OK)
2244 {
2245 if (item->isEligibleForRefund() && item_extended_cost != nullptr)
2246 {
2247 item->getOwner()->getItemInterface()->AddRefundable(item->getGuid(), item_extended_cost->costid);
2248 }
2249 _player->sendItemPushResultPacket(false, true, false, slotResult.ContainerSlot,
2250 slotResult.Result, 1, item->getEntry(), item->getPropertySeed(),
2251 item->getRandomPropertiesId(), item->getStackCount());
2252 }
2253 }
2254 }
2255 }
2256 else
2257 {
2258 addItem->modStackCount(srlPacket.amount * creature_item.amount);
2259 addItem->m_isDirty = true;
2260 _player->sendItemPushResultPacket(false, true, false,
2261 static_cast<uint8_t>(_player->getItemInterface()->GetBagSlotByGuid(addItem->getGuid())), 0,
2262 srlPacket.amount * creature_item.amount, addItem->getEntry(), addItem->getPropertySeed(),
2263 addItem->getRandomPropertiesId(), addItem->getStackCount());
2264 }
2265
2266 _player->getItemInterface()->BuyItem(it, srlPacket.amount, creature);
2267
2269 srlPacket.amount * creature_item.amount).serialise().get());
2270
2271 if (creature_item.max_amount)
2272 {
2273 creature->ModAvItemAmount(creature_item.itemid, creature_item.amount * srlPacket.amount);
2274
2275 sendInventoryList(creature);
2276 }
2277}
@ ADD_ITEM_RESULT_OK
@ INV_ERR_ITEM_CANT_STACK
@ INV_ERR_DONT_OWN_THAT_ITEM
WDB::Structures::ItemExtendedCostEntry const * GetItemExtendedCostByItemId(uint32_t itemid)
void AddRefundable(uint64_t GUID, uint32_t extendedcost)
Inserts a new entry into the RefundableMap. This should be called when purchasing the item.
Player * getOwner() const
Definition Item.cpp:945
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleBuyStableSlot()

void WorldSession::handleBuyStableSlot ( WorldPacket )
protected

Definition at line 387 of file PetHandler.cpp.

388{
389 uint32_t stable_cost = 0;
390
391#if VERSION_STRING < Cata
392 const auto stableSlotPrices = sStableSlotPricesStore.lookupEntry(_player->getStableSlotCount() + 1);
393
394 if (stableSlotPrices != nullptr)
395 stable_cost = stableSlotPrices->Price;
396#endif
397
398 if (!_player->hasEnoughCoinage(stable_cost))
399 {
401 return;
402 }
403
404 _player->modCoinage(-static_cast<int32_t>(stable_cost));
405
407
409}
uint8_t getStableSlotCount() const
Definition Player.cpp:12663
uint8_t m_stableSlotCount
Definition Player.hpp:1808
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCalendarAddEvent()

void WorldSession::handleCalendarAddEvent ( WorldPacket recvPacket)
protected

Definition at line 45 of file CalendarHandler.cpp.

46{
47#if VERSION_STRING > TBC
48 // Create an Event and save it to char db
49 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarAddEvent Not handled");
50
51 uint32_t guid = static_cast<uint32_t>(_player->getGuid());
52
53 std::string title;
54 std::string description;
55 uint8_t type;
56 uint8_t repeatable;
57 uint32_t maxInvites;
58 int32_t dungeonId;
59 uint32_t eventPackedTime;
60 uint32_t unkPackedTime;
61 uint32_t flags;
62
63 recvPacket >> title;
64 recvPacket >> description;
65 recvPacket >> type;
66 recvPacket >> repeatable;
67 recvPacket >> maxInvites;
68 recvPacket >> dungeonId;
69 recvPacket.ReadPackedTime(eventPackedTime);
70 recvPacket.ReadPackedTime(unkPackedTime);
71 recvPacket >> flags;
72
73 // \todo save it to db
74 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarAddEvent Playerguid: {} sends Calendarevent: Title: {}, Description: {}, Type: {}, Repeatable: {}, maxInvites: {}, dungeonId: {}, PackedTime: {}, unkPackedTime: {}, Flags: {},",
75 guid, title, description, type, repeatable, maxInvites, dungeonId, eventPackedTime, unkPackedTime, flags);
76#endif
77}
uint32_t ReadPackedTime()
Definition ByteBuffer.h:474
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCalendarArenaTeam()

void WorldSession::handleCalendarArenaTeam ( WorldPacket recvPacket)
protected

Definition at line 93 of file CalendarHandler.cpp.

94{
95#if VERSION_STRING > TBC
96 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarArenaTeam Not handled");
97#endif
98}
Here is the caller graph for this function:

◆ handleCalendarComplain()

void WorldSession::handleCalendarComplain ( WorldPacket recvPacket)
protected

Definition at line 25 of file CalendarHandler.cpp.

26{
27#if VERSION_STRING > TBC
28 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarComplain Not handled");
29#endif
30}
Here is the caller graph for this function:

◆ handleCalendarCopyEvent()

void WorldSession::handleCalendarCopyEvent ( WorldPacket recvPacket)
protected

Definition at line 114 of file CalendarHandler.cpp.

115{
116#if VERSION_STRING > TBC
117 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarCopyEvent Not handled");
118#endif
119}
Here is the caller graph for this function:

◆ handleCalendarEventInvite()

void WorldSession::handleCalendarEventInvite ( WorldPacket recvPacket)
protected

Definition at line 121 of file CalendarHandler.cpp.

122{
123#if VERSION_STRING > TBC
124 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarEventInvite Not handled");
125#endif
126}
Here is the caller graph for this function:

◆ handleCalendarEventModeratorStatus()

void WorldSession::handleCalendarEventModeratorStatus ( WorldPacket recvPacket)
protected

Definition at line 149 of file CalendarHandler.cpp.

150{
151#if VERSION_STRING > TBC
152 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarEventModeratorStatus Not handled");
153#endif
154}
Here is the caller graph for this function:

◆ handleCalendarEventRemoveInvite()

void WorldSession::handleCalendarEventRemoveInvite ( WorldPacket recvPacket)
protected

Definition at line 135 of file CalendarHandler.cpp.

136{
137#if VERSION_STRING > TBC
138 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarEventRemoveInvite Not handled");
139#endif
140}
Here is the caller graph for this function:

◆ handleCalendarEventRsvp()

void WorldSession::handleCalendarEventRsvp ( WorldPacket recvPacket)
protected

Definition at line 128 of file CalendarHandler.cpp.

129{
130#if VERSION_STRING > TBC
131 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarEventRsvp Not handled");
132#endif
133}
Here is the caller graph for this function:

◆ handleCalendarEventStatus()

void WorldSession::handleCalendarEventStatus ( WorldPacket recvPacket)
protected

Definition at line 142 of file CalendarHandler.cpp.

143{
144#if VERSION_STRING > TBC
145 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarEventStatus Not handled");
146#endif
147}
Here is the caller graph for this function:

◆ handleCalendarGetCalendar()

void WorldSession::handleCalendarGetCalendar ( WorldPacket )
protected

Definition at line 14 of file CalendarHandler.cpp.

15{
16#if VERSION_STRING > TBC
17 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarGetCalendar Not handled");
18
19 /* Get all events for the player */
20 uint32_t guid = static_cast<uint32_t>(_player->getGuid());
21 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarGetCalendar CMSG_CALENDAR_GET_CALENDAR for guid {}", guid);
22#endif
23}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCalendarGetEvent()

void WorldSession::handleCalendarGetEvent ( WorldPacket recvPacket)
protected

Definition at line 79 of file CalendarHandler.cpp.

80{
81#if VERSION_STRING > TBC
82 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarGetEvent Not handled");
83#endif
84}
Here is the caller graph for this function:

◆ handleCalendarGetNumPending()

void WorldSession::handleCalendarGetNumPending ( WorldPacket )
protected

Definition at line 32 of file CalendarHandler.cpp.

33{
34#if VERSION_STRING > TBC
35 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarGetNumPending Not handled");
36
38#if VERSION_STRING >= Cata
39 data << uint32_t(0); // num pending
40#endif
41 SendPacket(&data);
42#endif
43}
@ SMSG_CALENDAR_SEND_NUM_PENDING
Definition Opcodes.hpp:1228
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCalendarGuildFilter()

void WorldSession::handleCalendarGuildFilter ( WorldPacket recvPacket)
protected

Definition at line 86 of file CalendarHandler.cpp.

87{
88#if VERSION_STRING > TBC
89 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarGuildFilter Not handled");
90#endif
91}
Here is the caller graph for this function:

◆ handleCalendarRemoveEvent()

void WorldSession::handleCalendarRemoveEvent ( WorldPacket recvPacket)
protected

Definition at line 107 of file CalendarHandler.cpp.

108{
109#if VERSION_STRING > TBC
110 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarRemoveEvent Not handled");
111#endif
112}
Here is the caller graph for this function:

◆ handleCalendarUpdateEvent()

void WorldSession::handleCalendarUpdateEvent ( WorldPacket recvPacket)
protected

Definition at line 100 of file CalendarHandler.cpp.

101{
102#if VERSION_STRING > TBC
103 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "HandleCalendarUpdateEvent Not handled");
104#endif
105}
Here is the caller graph for this function:

◆ handleCancelAuction()

void WorldSession::handleCancelAuction ( WorldPacket recvPacket)
protected

Definition at line 57 of file AuctionHandler.cpp.

58{
59 CmsgAuctionRemoveItem srlPacket;
60 if (!srlPacket.deserialise(recvPacket))
61 return;
62
63 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_AUCTION_REMOVE_ITEM {} (auctionId)", srlPacket.auctionId);
64
65 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
66 if (creature == nullptr || creature->auctionHouse == nullptr)
67 return;
68
69 const auto auction = creature->auctionHouse->getAuction(srlPacket.auctionId);
70 if (auction == nullptr)
71 return;
72
73 creature->auctionHouse->queueDeletion(auction, AUCTION_REMOVE_CANCELLED);
74
76
77 creature->auctionHouse->sendOwnerListPacket(_player, nullptr);
78}
@ AUCTION_REMOVE_CANCELLED
@ AUCTION_ACTION_CANCEL
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCancelAuraOpcode()

void WorldSession::handleCancelAuraOpcode ( WorldPacket recvPacket)
protected

Definition at line 189 of file SpellHandler.cpp.

190{
191 uint32_t spellId;
192 recvPacket >> spellId;
193
194 const auto spellInfo = sSpellMgr.getSpellInfo(spellId);
195 if (spellInfo == nullptr)
196 return;
197
198 if (spellInfo->getAttributes() & ATTRIBUTES_CANT_CANCEL)
199 return;
200
201 // You can't cancel a passive aura
202 if (spellInfo->isPassive())
203 return;
204
205 // You can't cancel an aura which is from a channeled spell, unless you are currently channeling it
206 if (spellInfo->isChanneled())
207 {
209 {
212 }
213
214 return;
215 }
216
217 Aura* spellAura = _player->getAuraWithId(spellId);
218 if (spellAura == nullptr)
219 return;
220
221 // You can't cancel negative auras
222 if (spellAura->isNegative())
223 return;
224
225 spellAura->removeAura();
226}
@ CURRENT_CHANNELED_SPELL
Definition Object.hpp:68
@ ATTRIBUTES_CANT_CANCEL
\ todo: Heartbeat resist, not implemented
bool isNegative() const
void removeAura(AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
Spell * getCurrentSpell(CurrentSpellType spellType) const
Definition Object.cpp:600
uint32_t getId() const
SpellInfo const * getSpellInfo() const
Definition Spell.cpp:5789
Aura * getAuraWithId(uint32_t spell_id) const
Definition Unit.cpp:4849
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCancelAutoRepeatSpellOpcode()

void WorldSession::handleCancelAutoRepeatSpellOpcode ( WorldPacket )
protected

Definition at line 235 of file SpellHandler.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCancelCastOpcode()

void WorldSession::handleCancelCastOpcode ( WorldPacket recvPacket)
protected

Definition at line 175 of file SpellHandler.cpp.

176{
177 uint32_t spellId;
178#if VERSION_STRING > TBC
179 recvPacket.read_skip<uint8_t>(); // Increments with every HandleCancelCast packet, unused
180#endif
181 recvPacket >> spellId;
182
183 if (_player->isCastingSpell())
184 {
185 _player->interruptSpell(spellId, false);
186 }
187}
void read_skip()
Definition ByteBuffer.h:681
bool isCastingSpell(bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false) const
Definition Object.cpp:735
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCancelChannellingOpcode()

void WorldSession::handleCancelChannellingOpcode ( WorldPacket recvPacket)
protected

Definition at line 228 of file SpellHandler.cpp.

229{
230 recvPacket.read_skip<uint32_t>(); // Spell Id, unused
231
233}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCancelTemporaryEnchantmentOpcode()

void WorldSession::handleCancelTemporaryEnchantmentOpcode ( WorldPacket recvPacket)
protected

Definition at line 2731 of file ItemHandler.cpp.

2732{
2733 CmsgCancelTempEnchantment srlPacket;
2734 if (!srlPacket.deserialise(recvPacket))
2735 return;
2736
2737 Item* item = _player->getItemInterface()->GetInventoryItem(static_cast<int16_t>(srlPacket.inventorySlot));
2738 if (!item)
2739 return;
2740
2741 item->removeAllEnchantments(true);
2742}
void removeAllEnchantments(bool onlyTemporary)
Definition Item.cpp:407
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCancelTotem()

void WorldSession::handleCancelTotem ( WorldPacket recvPacket)
protected

Definition at line 362 of file SpellHandler.cpp.

363{
364 uint8_t totemSlot;
365 recvPacket >> totemSlot;
366
367 // Clientside slot is zero indexed
368 totemSlot += 1;
369 if (totemSlot >= MAX_SUMMON_SLOT)
370 {
371 sLogger.failure("Player {} tried to cancel totem from out of range slot {}, ignored.", _player->getGuidLow(), totemSlot);
372 return;
373 }
374
375 const auto summon = _player->getSummonInterface()->getSummonInSlot(static_cast<SummonSlot>(totemSlot));
376 if (summon != nullptr)
377 summon->unSummon();
378}
SummonSlot
@ MAX_SUMMON_SLOT
Summon * getSummonInSlot(SummonSlot slot) const
virtual void unSummon()
Definition Summon.cpp:230
SummonHandler * getSummonInterface()
Definition Unit.cpp:7943
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCancelTrade()

void WorldSession::handleCancelTrade ( WorldPacket recvPacket)
protected

Definition at line 475 of file TradeHandler.cpp.

476{
477 if (_player != nullptr)
478 _player->cancelTrade(true);
479}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCastSpellOpcode()

void WorldSession::handleCastSpellOpcode ( WorldPacket recvPacket)
protected

Definition at line 87 of file SpellHandler.cpp.

88{
89 CmsgCastSpell srlPacket;
90 if (!srlPacket.deserialise(recvPacket))
91 return;
92
93 const auto spellInfo = sSpellMgr.getSpellInfo(srlPacket.spell_id);
94 if (spellInfo == nullptr)
95 {
96 sLogger.failure("Unknown spell id {} in handleCastSpellOpcode().", srlPacket.spell_id);
97 return;
98 }
99
100 // Check does player have the spell
101 if (!_player->hasSpell(srlPacket.spell_id))
102 {
103 sCheatLog.writefromsession(this, "WORLD: Player %u tried to cast spell %u but player does not have it.", _player->getGuidLow(), srlPacket.spell_id);
104 sLogger.info("WORLD: Player {} tried to cast spell {} but player does not have it.", _player->getGuidLow(), srlPacket.spell_id);
105 return;
106 }
107
108 // Check is player trying to cast a passive spell
109 if (spellInfo->isPassive())
110 {
111 sCheatLog.writefromsession(this, "WORLD: Player %u tried to cast a passive spell %u, ignored", _player->getGuidLow(), srlPacket.spell_id);
112 sLogger.info("WORLD: Player {} tried to cast a passive spell {}, ignored", _player->getGuidLow(), srlPacket.spell_id);
113 return;
114 }
115
116 // Check are we already casting this autorepeat spell
117 if (spellInfo->isRangedAutoRepeat() && _player->getCurrentSpell(CURRENT_AUTOREPEAT_SPELL) != nullptr
119 {
120 return;
121 }
122
123 // TODO: move this check to new Spell::prepare() and clean it
124 if (_player->isCastingSpell(true, true, spellInfo->getId() == 75))
125 {
127 return;
128 }
129
130 SpellCastTargets targets(recvPacket, _player->getGuid());
131 Spell* spell = sSpellMgr.newSpell(_player, spellInfo, false, nullptr);
132 spell->extra_cast_number = srlPacket.cast_count;
133
134#if VERSION_STRING >= Cata
135 spell->m_glyphslot = srlPacket.glyphSlot;
136#endif
137
138 // Some spell cast packets include more data
139 if (srlPacket.flags & 0x02)
140 {
141 float projectilePitch, projectileSpeed;
142 uint8_t hasMovementData; // 1 or 0
143 recvPacket >> projectilePitch >> projectileSpeed >> hasMovementData;
144
145 LocationVector const spellDestination = targets.getDestination();
146 LocationVector const spellSource = targets.getSource();
147 float const deltaX = spellDestination.x - spellSource.x; // Calculate change of x position
148 float const deltaY = spellDestination.y - spellSource.y; // Calculate change of y position
149
150 uint32_t travelTime = 0;
151 if ((projectilePitch != M_PI / 4) && (projectilePitch != -M_PI / 4)) // No division by zero
152 {
153 // Calculate projectile's travel time by using Pythagorean theorem to get distance from delta X and delta Y, and divide that with the projectile's velocity
154 travelTime = static_cast<uint32_t>((sqrtf(deltaX * deltaX + deltaY * deltaY) / (cosf(projectilePitch) * projectileSpeed)) * 1000);
155 }
156
157 if (hasMovementData)
158 {
159#if VERSION_STRING < Cata
160 recvPacket.SetOpcode(recvPacket.read<uint16_t>()); // MSG_MOVE_STOP
161 handleMovementOpcodes(recvPacket);
162#else
163 recvPacket.SetOpcode(recvPacket.read<uint32_t>()); // MSG_MOVE_STOP
164 handleMovementOpcodes(recvPacket);
165#endif
166 }
167
168 spell->m_missilePitch = projectilePitch;
169 spell->m_missileTravelTime = travelTime;
170 }
171
172 spell->prepare(&targets);
173}
#define M_PI
@ SPELL_FAILED_SPELL_IN_PROGRESS
void sendCastFailedPacket(uint32_t spellId, uint8_t errorMessage, uint8_t multiCast, uint32_t extra1, uint32_t extra2=0)
Definition Player.cpp:9714
bool hasSpell(uint32_t spellId) const
Definition Player.cpp:3925
uint8_t extra_cast_number
Definition Spell.hpp:685
uint32_t m_missileTravelTime
Definition Spell.hpp:722
uint32_t m_glyphslot
Definition Spell.hpp:686
float m_missilePitch
Definition Spell.hpp:721
void SetOpcode(uint16_t opcode)
Definition WorldPacket.h:28
void handleMovementOpcodes(WorldPacket &recvPacket)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChangeSeatsOnControlledVehicle()

void WorldSession::handleChangeSeatsOnControlledVehicle ( WorldPacket recvPacket)
protected

Definition at line 109 of file VehicleHandler.cpp.

110{
111#if VERSION_STRING > TBC
112 Unit* vehicle_base = GetPlayer()->getVehicleBase();
113 if (!vehicle_base)
114 return;
115
116 auto seat = GetPlayer()->getVehicle()->getSeatForPassenger(GetPlayer());
117 if (!seat->canSwitchFromSeat())
118 return;
119
120#if VERSION_STRING < Cata
122 if (!srlPacket.deserialise(recvPacket))
123 return;
124
125 uint64_t guid = srlPacket.sourceGuid; // current vehicle guid
126 uint64_t accessory = srlPacket.destinationGuid; // accessory guid
127
128 vehicle_base->obj_movement_info = srlPacket.movementInfo;
129 int8_t seatId = srlPacket.seat;
130
131 if (vehicle_base->getGuid() != guid)
132 return;
133
134 if (!accessory)
135 {
136 GetPlayer()->callChangeSeat(seatId, seatId > 0); // prev/next
137 }
138 else if (Unit* vehUnit = GetPlayer()->getWorldMapUnit(accessory))
139 {
140 if (Vehicle* vehicle = vehUnit->getVehicleKit())
141 if (vehicle->hasEmptySeat(seatId))
142 vehUnit->handleSpellClick(GetPlayer(), seatId);
143 }
144 else
145 {
146 if (vehicle_base->getVehicle())
147 if (vehicle_base->getVehicle()->hasEmptySeat(seatId))
148 vehicle_base->getVehicleBase()->handleSpellClick(GetPlayer(), seatId);
149 }
150
151#else
152 static MovementStatusElements const accessoryGuid[] =
153 {
171 };
172
173 ExtraMovementStatusElement extra(accessoryGuid);
174 MovementInfo movementInfo;
175 movementInfo.readMovementInfo(recvPacket, recvPacket.GetOpcode(), &extra);
176 vehicle_base->obj_movement_info = movementInfo;
177
178 ObjectGuid accessory = extra.Data.guid;
179 int8_t seatId = extra.Data.byteData;
180
181 if (vehicle_base->getGuid() != movementInfo.guid)
182 return;
183
184 if (!accessory)
185 {
186 GetPlayer()->callChangeSeat(seatId, seatId > 0); // prev/next
187 }
188 else if (Unit* vehUnit = GetPlayer()->getWorldMapUnit(accessory))
189 {
190 if (Vehicle* vehicle = vehUnit->getVehicleKit())
191 if (vehicle->hasEmptySeat(seatId))
192 vehUnit->handleSpellClick(GetPlayer(), seatId);
193 }
194 else
195 {
196 if (vehicle_base->getVehicle())
197 if (vehicle_base->getVehicle()->hasEmptySeat(seatId))
198 vehicle_base->getVehicleBase()->handleSpellClick(GetPlayer(), seatId);
199 }
200#endif
201#endif
202}
MovementStatusElements
@ MSEGuidBit0
@ MSEGuidByte6
@ MSEExtraInt8
@ MSEGuidBit3
@ MSEGuidBit2
@ MSEGuidByte1
@ MSEGuidByte2
@ MSEGuidByte0
@ MSEGuidBit6
@ MSEGuidBit1
@ MSEGuidBit4
@ MSEGuidBit7
@ MSEGuidByte3
@ MSEGuidBit5
@ MSEGuidByte5
@ MSEGuidByte7
@ MSEGuidByte4
MovementInfo obj_movement_info
Definition Object.hpp:632
Definition Unit.hpp:147
void handleSpellClick(Unit *clicker)
Definition Unit.cpp:8505
ObjectGuid guid
void readMovementInfo(ByteBuffer &data, uint16_t opcode, ExtraMovementStatusElement *extras=nullptr)
Definition Object.cpp:5261
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelAnnounce()

void WorldSession::handleChannelAnnounce ( WorldPacket recvPacket)
protected

Definition at line 215 of file ChannelHandler.cpp.

216{
217 CmsgChannelAnnouncements srlPacket;
218 if (!srlPacket.deserialise(recvPacket))
219 return;
220
221 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
222 if (channel)
223 channel->enableAnnouncements(_player);
224}
#define sChannelMgr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelBan()

void WorldSession::handleChannelBan ( WorldPacket recvPacket)
protected

Definition at line 191 of file ChannelHandler.cpp.

192{
193 CmsgChannelBan srlPacket;
194 if (!srlPacket.deserialise(recvPacket))
195 return;
196
197 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
198 const auto player = sObjectMgr.getPlayer(srlPacket.banName.c_str(), false);
199 if (channel && player)
200 channel->kickOrBanPlayer(_player, player, true);
201}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelInvite()

void WorldSession::handleChannelInvite ( WorldPacket recvPacket)
protected

Definition at line 167 of file ChannelHandler.cpp.

168{
169 CmsgChannelInvite srlPacket;
170 if (!srlPacket.deserialise(recvPacket))
171 return;
172
173 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
174 const auto player = sObjectMgr.getPlayer(srlPacket.inviteName.c_str(), false);
175 if (channel && player)
176 channel->invitePlayer(_player, player);
177}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelJoin()

void WorldSession::handleChannelJoin ( WorldPacket recvPacket)
protected

Definition at line 35 of file ChannelHandler.cpp.

36{
37 CmsgJoinChannel srlPacket;
38 if (!srlPacket.deserialise(recvPacket))
39 return;
40
41 if (!sWorld.settings.gm.gmClientChannelName.empty() && AscEmu::Util::Strings::isEqual(sWorld.settings.gm.gmClientChannelName.c_str(), srlPacket.channelName.c_str()) && !hasPermissions())
42 return;
43
44 const auto channel = sChannelMgr.getOrCreateChannel(srlPacket.channelName, _player, srlPacket.dbcId);
45 if (channel == nullptr)
46 return;
47
48 channel->attemptJoin(_player, srlPacket.password.c_str());
49 sLogger.debug("ChannelJoin {}", srlPacket.channelName);
50}
bool hasPermissions() const
bool isEqual(const char *lhs, const char *rhs)
Returns true if both strings are equal (case sensitive)
Definition Strings.cpp:68
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelKick()

void WorldSession::handleChannelKick ( WorldPacket recvPacket)
protected

Definition at line 179 of file ChannelHandler.cpp.

180{
181 CmsgChannelKick srlPacket;
182 if (!srlPacket.deserialise(recvPacket))
183 return;
184
185 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
186 const auto player = sObjectMgr.getPlayer(srlPacket.kickName.c_str(), false);
187 if (channel && player)
188 channel->kickOrBanPlayer(_player, player, false);
189}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelLeave()

void WorldSession::handleChannelLeave ( WorldPacket recvPacket)
protected

Definition at line 63 of file ChannelHandler.cpp.

64{
65 CmsgLeaveChannel srlPacket;
66 if (!srlPacket.deserialise(recvPacket))
67 return;
68
69 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
70 if (channel)
71 channel->leaveChannel(_player);
72}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelList()

void WorldSession::handleChannelList ( WorldPacket recvPacket)
protected

Definition at line 74 of file ChannelHandler.cpp.

75{
76 CmsgChannelList srlPacket;
77 if (!srlPacket.deserialise(recvPacket))
78 return;
79
80 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
81 if (channel)
82 channel->listMembers(_player, true);
83}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelModerate()

void WorldSession::handleChannelModerate ( WorldPacket recvPacket)
protected

Definition at line 226 of file ChannelHandler.cpp.

227{
228 CmsgChannelModerate srlPacket;
229 if (!srlPacket.deserialise(recvPacket))
230 return;
231
232 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
233 if (channel)
234 channel->moderateChannel(_player);
235}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelModerator()

void WorldSession::handleChannelModerator ( WorldPacket recvPacket)
protected

Definition at line 119 of file ChannelHandler.cpp.

120{
121 CmsgChannelModerator srlPacket;
122 if (!srlPacket.deserialise(recvPacket))
123 return;
124
125 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
126 const auto player = sObjectMgr.getPlayer(srlPacket.modName.c_str(), false);
127 if (channel && player)
128 channel->giveModerator(_player, player);
129}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelMute()

void WorldSession::handleChannelMute ( WorldPacket recvPacket)
protected

Definition at line 143 of file ChannelHandler.cpp.

144{
145 CmsgChannelMute srlPacket;
146 if (!srlPacket.deserialise(recvPacket))
147 return;
148
149 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
150 const auto player = sObjectMgr.getPlayer(srlPacket.muteName.c_str(), false);
151 if (channel && player)
152 channel->mutePlayer(_player, player);
153}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelOwner()

void WorldSession::handleChannelOwner ( WorldPacket recvPacket)
protected

Definition at line 108 of file ChannelHandler.cpp.

109{
110 CmsgChannelOwner srlPacket;
111 if (!srlPacket.deserialise(recvPacket))
112 return;
113
114 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
115 if (channel)
116 channel->getOwner(_player);
117}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelPassword()

void WorldSession::handleChannelPassword ( WorldPacket recvPacket)
protected

Definition at line 85 of file ChannelHandler.cpp.

86{
87 CmsgChannelPassword srlPacket;
88 if (!srlPacket.deserialise(recvPacket))
89 return;
90
91 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
92 if (channel)
93 channel->setPassword(_player, srlPacket.password.c_str());
94}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelRosterQuery()

void WorldSession::handleChannelRosterQuery ( WorldPacket recvPacket)
protected

Definition at line 237 of file ChannelHandler.cpp.

238{
239 CmsgChannelDisplayList srlPacket;
240 if (!srlPacket.deserialise(recvPacket))
241 return;
242
243 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
244 if (channel)
245 channel->listMembers(_player, false);
246}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelSetOwner()

void WorldSession::handleChannelSetOwner ( WorldPacket recvPacket)
protected

Definition at line 96 of file ChannelHandler.cpp.

97{
98 CmsgChannelSetOwner srlPacket;
99 if (!srlPacket.deserialise(recvPacket))
100 return;
101
102 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
103 const auto player = sObjectMgr.getPlayer(srlPacket.setName.c_str(), false);
104 if (channel && player)
105 channel->setOwner(_player, player);
106}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelUnban()

void WorldSession::handleChannelUnban ( WorldPacket recvPacket)
protected

Definition at line 203 of file ChannelHandler.cpp.

204{
205 CmsgChannelUnban srlPacket;
206 if (!srlPacket.deserialise(recvPacket))
207 return;
208
209 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
210 const auto playerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.unbanName);
211 if (channel && playerInfo)
212 channel->unBanPlayer(_player, playerInfo);
213}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelUnmoderator()

void WorldSession::handleChannelUnmoderator ( WorldPacket recvPacket)
protected

Definition at line 131 of file ChannelHandler.cpp.

132{
133 CmsgChannelUnmoderator srlPacket;
134 if (!srlPacket.deserialise(recvPacket))
135 return;
136
137 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
138 const auto player = sObjectMgr.getPlayer(srlPacket.unmodName.c_str(), false);
139 if (channel && player)
140 channel->takeModerator(_player, player);
141}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChannelUnmute()

void WorldSession::handleChannelUnmute ( WorldPacket recvPacket)
protected

Definition at line 155 of file ChannelHandler.cpp.

156{
157 CmsgChannelUnmute srlPacket;
158 if (!srlPacket.deserialise(recvPacket))
159 return;
160
161 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
162 const auto player = sObjectMgr.getPlayer(srlPacket.unmuteName.c_str(), false);
163 if (channel && player)
164 channel->unMutePlayer(_player, player);
165}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharCreateOpcode()

void WorldSession::handleCharCreateOpcode ( WorldPacket recvPacket)
protected

Definition at line 379 of file CharacterHandler.cpp.

380{
381 CmsgCharCreate srlPacket;
382 if (!srlPacket.deserialise(recvPacket))
383 return;
384
385 const auto loginErrorCode = VerifyName(srlPacket.createStruct.name);
386 if (loginErrorCode != E_CHAR_NAME_SUCCESS)
387 {
388 SendPacket(SmsgCharCreate(loginErrorCode).serialise().get());
389 return;
390 }
391
392 const auto isAllowed = sMySQLStore.isCharacterNameAllowed(srlPacket.createStruct.name);
393 if (!isAllowed)
394 {
396 return;
397 }
398
399 if (sObjectMgr.getCachedCharacterInfoByName(srlPacket.createStruct.name) != nullptr)
400 {
402 return;
403 }
404
405 const auto isValid = sHookInterface.OnNewCharacter(srlPacket.createStruct._race, srlPacket.createStruct._class,
406 this, srlPacket.createStruct.name.c_str());
407 if (!isValid)
408 {
410 return;
411 }
412
413 const auto bannedNamesQuery = CharacterDatabase.Query("SELECT COUNT(*) FROM banned_names WHERE name = '%s'",
414 CharacterDatabase.EscapeString(srlPacket.createStruct.name).c_str());
415 if (bannedNamesQuery)
416 {
417 if (bannedNamesQuery->Fetch()[0].asUint32() > 0)
418 {
420 return;
421 }
422 }
423
424#if VERSION_STRING > TBC
425 if (worldConfig.player.deathKnightLimit && has_dk && srlPacket.createStruct._class == DEATHKNIGHT)
426 {
427 SendPacket(SmsgCharCreate(E_CHAR_CREATE_UNIQUE_CLASS_LIMIT).serialise().get());
428 return;
429 }
430#endif
431
432 const auto charactersQuery = CharacterDatabase.Query("SELECT COUNT(*) FROM characters WHERE acct = %u", GetAccountId());
433 if (charactersQuery)
434 {
435 if (charactersQuery->Fetch()[0].asUint32() >= 10)
436 {
438 return;
439 }
440 }
441
442 const auto newPlayer = sObjectMgr.createPlayer(srlPacket.createStruct._class);
443 newPlayer->setSession(this);
444
445 if (!newPlayer->create(srlPacket.createStruct))
446 {
447 newPlayer->m_isReadyToBeRemoved = true;
448 delete newPlayer;
449
451 return;
452 }
453
454 const auto realmType = sLogonCommHandler.getRealmType();
455 if (!HasGMPermissions() && realmType == REALMTYPE_PVP && _side != 255 && !worldConfig.player.isCrossoverCharsCreationEnabled)
456 {
457 if ((newPlayer->isTeamAlliance() && _side == 1) || (newPlayer->isTeamHorde() && _side == 0))
458 {
459 newPlayer->m_isReadyToBeRemoved = true;
460 delete newPlayer;
461
463 return;
464 }
465 }
466
467#if VERSION_STRING > TBC
468 if (worldConfig.player.deathKnightPreReq && !has_level_55_char && srlPacket.createStruct._class == DEATHKNIGHT)
469 {
470 newPlayer->m_isReadyToBeRemoved = true;
471 delete newPlayer;
472
473 SendPacket(SmsgCharCreate(E_CHAR_CREATE_LEVEL_REQUIREMENT).serialise().get());
474 return;
475 }
476#endif
477
478 newPlayer->unsetBanned();
479
480 if (newPlayer->getClass() == WARLOCK)
481 {
482 newPlayer->addSummonSpell(416, 3110);
483 newPlayer->addSummonSpell(417, 19505);
484 newPlayer->addSummonSpell(1860, 3716);
485 newPlayer->addSummonSpell(1863, 7814);
486 }
487
488 newPlayer->saveToDB(true);
489
490 auto playerInfo = std::make_unique<CachedCharacterInfo>();
491 playerInfo->guid = newPlayer->getGuidLow();
492 utf8_string name = newPlayer->getName();
494 playerInfo->name = name;
495 playerInfo->cl = newPlayer->getClass();
496 playerInfo->race = newPlayer->getRace();
497 playerInfo->gender = newPlayer->getGender();
498 playerInfo->acct = GetAccountId();
499 playerInfo->m_Group = nullptr;
500 playerInfo->subGroup = 0;
501 playerInfo->team = newPlayer->getTeam();
502 playerInfo->m_guild = 0;
503 playerInfo->guildRank = GUILD_RANK_NONE;
504 playerInfo->lastOnline = UNIXTIME;
505
506 sObjectMgr.addCachedCharacterInfo(std::move(playerInfo));
507
508 newPlayer->m_isReadyToBeRemoved = true;
509 delete newPlayer;
510
512
513 sLogonCommHandler.updateAccountCount(GetAccountId(), 1);
514}
@ E_CHAR_CREATE_PVP_TEAMS_VIOLATION
@ E_CHAR_CREATE_NAME_IN_USE
@ E_CHAR_CREATE_FAILED
@ E_CHAR_CREATE_SERVER_LIMIT
@ E_CHAR_NAME_PROFANE
@ E_CHAR_CREATE_ERROR
@ E_CHAR_NAME_SUCCESS
@ E_CHAR_CREATE_SUCCESS
#define GUILD_RANK_NONE
#define sLogonCommHandler
@ REALMTYPE_PVP
CharacterErrorCodes VerifyName(utf8_string name)
void capitalize(std::string &str)
Capitalize word (uppercase first char, lowercase rest)
Definition Strings.cpp:28
utf8_string name
std::string utf8_string
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharCustomizeLooksOpcode()

void WorldSession::handleCharCustomizeLooksOpcode ( WorldPacket recvPacket)
protected

Definition at line 516 of file CharacterHandler.cpp.

517{
518#if VERSION_STRING > TBC
519 CmsgCharCustomize srlPacket;
520 if (!srlPacket.deserialise(recvPacket))
521 return;
522
523 const auto loginErrorCode = VerifyName(srlPacket.createStruct.name);
524 if (loginErrorCode != E_CHAR_NAME_SUCCESS)
525 {
526 SendPacket(SmsgCharCustomize(loginErrorCode).serialise().get());
527 return;
528 }
529
530 auto result = CharacterDatabase.Query("SELECT COUNT(*) FROM `banned_names` WHERE name = '%s'",
531 CharacterDatabase.EscapeString(srlPacket.createStruct.name).c_str());
532 if (result)
533 {
534 if (result->Fetch()[0].asUint32() > 0)
535 {
537 return;
538 }
539 }
540
541 const auto playerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.createStruct.name);
542 if (playerInfo != nullptr && playerInfo->guid != srlPacket.guid.getGuidLow())
543 {
545 return;
546 }
547
548 AscEmu::Util::Strings::capitalize(srlPacket.createStruct.name);
549
550 CharacterDatabase.WaitExecute("UPDATE `characters` set name = '%s' WHERE guid = %u",
551 srlPacket.createStruct.name.c_str(), srlPacket.guid.getGuidLow());
552 CharacterDatabase.WaitExecute("UPDATE `characters` SET login_flags = %u WHERE guid = %u",
553 static_cast<uint32_t>(LOGIN_NO_FLAG), srlPacket.guid.getGuidLow());
554
555 Player::changeLooks(srlPacket.guid, srlPacket.createStruct.gender, srlPacket.createStruct.skin,
556 srlPacket.createStruct.face, srlPacket.createStruct.hairStyle, srlPacket.createStruct.hairColor,
557 srlPacket.createStruct.facialHair);
558
559 SendPacket(SmsgCharCustomize(E_RESPONSE_SUCCESS, srlPacket.guid, srlPacket.createStruct).serialise().get());
560#endif
561}
@ E_RESPONSE_SUCCESS
Definition AuthCodes.h:11
@ LOGIN_NO_FLAG
static void changeLooks(uint64_t guid, uint8_t gender, uint8_t skin, uint8_t face, uint8_t hairStyle, uint8_t hairColor, uint8_t facialHair)
Definition Player.cpp:2887
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharDeleteOpcode()

void WorldSession::handleCharDeleteOpcode ( WorldPacket recvPacket)
protected

Definition at line 97 of file CharacterHandler.cpp.

98{
99 CmsgCharDelete srlPacket;
100 if (!srlPacket.deserialise(recvPacket))
101 return;
102
103 const uint8_t deleteResult = deleteCharacter(srlPacket.guid);
104 SendPacket(SmsgCharDelete(deleteResult).serialise().get());
105}
uint8_t deleteCharacter(WoWGuid guid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharEnumOpcode()

void WorldSession::handleCharEnumOpcode ( WorldPacket )
protected

Definition at line 944 of file CharacterHandler.cpp.

945{
946 auto asyncQuery = std::make_unique<AsyncQuery>(std::make_unique<SQLClassCallbackP1<World, uint32_t>>(&sWorld,
948
949 asyncQuery->AddQuery("SELECT guid, level, race, class, gender, bytes, bytes2, name, positionX, positionY, "
950 "positionZ, mapId, zoneId, banned, restState, deathstate, login_flags, player_flags, guild_members.guildId "
951 "FROM characters LEFT JOIN guild_members ON characters.guid = guild_members.playerid WHERE acct=%u ORDER BY guid LIMIT 10",
952 GetAccountId());
953
954 CharacterDatabase.QueueAsyncQuery(std::move(asyncQuery));
955}
void sendCharacterEnumToAccountSession(QueryResultVector &results, uint32_t accountId)
Definition World.cpp:340
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharFactionOrRaceChange()

void WorldSession::handleCharFactionOrRaceChange ( WorldPacket recvPacket)
protected

Definition at line 109 of file CharacterHandler.cpp.

110{
111#if VERSION_STRING > TBC
112 CmsgCharFactionChange srlPacket;
113 if (!srlPacket.deserialise(recvPacket))
114 return;
115
116 const auto playerInfoPacket = sObjectMgr.getCachedCharacterInfo(srlPacket.guid.getGuidLow());
117 if (playerInfoPacket == nullptr)
118 {
120 return;
121 }
122
123 const auto opcode = sOpcodeTables.getInternalIdForHex(recvPacket.GetOpcode());
124 const uint32_t used_loginFlag = ((opcode == CMSG_CHAR_RACE_CHANGE) ? LOGIN_CUSTOMIZE_RACE : LOGIN_CUSTOMIZE_FACTION);
125 uint32_t newflags = 0;
126
127 const auto loginFlagsQuery = CharacterDatabase.Query("SELECT login_flags FROM characters WHERE guid = %u", srlPacket.guid.getGuidLow());
128 if (loginFlagsQuery)
129 {
130 uint16_t loginFlags = loginFlagsQuery->Fetch()[0].asUint16();
131 if (!(loginFlags & used_loginFlag))
132 {
134 return;
135 }
136 newflags = loginFlags - used_loginFlag;
137 }
138
139 if (!sMySQLStore.getPlayerCreateInfo(srlPacket.charCreate._race, playerInfoPacket->cl))
140 {
142 return;
143 }
144
145 const auto loginErrorCode = VerifyName(srlPacket.charCreate.name);
146 if (loginErrorCode != E_CHAR_NAME_SUCCESS)
147 {
148 SendPacket(SmsgCharFactionChange(loginErrorCode).serialise().get());
149 return;
150 }
151
152 if (!HasGMPermissions())
153 {
154 const auto bannedNamesQuery = CharacterDatabase.Query("SELECT COUNT(*) FROM `banned_names` WHERE name = '%s'",
155 CharacterDatabase.EscapeString(srlPacket.charCreate.name).c_str());
156 if (bannedNamesQuery)
157 {
158 if (bannedNamesQuery->Fetch()[0].asUint32() > 0)
159 {
161 return;
162 }
163 }
164 }
165
166 const auto playerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.charCreate.name);
167 if (playerInfo != nullptr && playerInfo->guid != srlPacket.guid.getGuidLow())
168 {
170 return;
171 }
172
173 Player::changeLooks(srlPacket.guid, srlPacket.charCreate.gender, srlPacket.charCreate.skin,
174 srlPacket.charCreate.face, srlPacket.charCreate.hairStyle, srlPacket.charCreate.hairColor, srlPacket.charCreate.facialHair);
175
176 std::string newname = srlPacket.charCreate.name;
178 std::string oldName = playerInfoPacket->name;
179
180 sObjectMgr.updateCachedCharacterInfoName(playerInfoPacket, newname);
181
182 _player->setName(newname);
183
184 CharacterDatabase.Execute("UPDATE `characters` set name = '%s', login_flags = %u, race = %u WHERE guid = %u",
185 newname.c_str(), newflags, static_cast<uint32_t>(srlPacket.charCreate._race), srlPacket.guid.getGuidLow());
186
187 SendPacket(SmsgCharFactionChange(0, srlPacket.guid, srlPacket.charCreate).serialise().get());
188#endif
189}
@ E_CHAR_NAME_RESERVED
@ CMSG_CHAR_RACE_CHANGE
Definition Opcodes.hpp:1405
void setName(std::string name)
Definition Player.cpp:2640
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharRenameOpcode()

void WorldSession::handleCharRenameOpcode ( WorldPacket recvPacket)
protected

Definition at line 211 of file CharacterHandler.cpp.

212{
213 CmsgCharRename srlPacket;
214 if (!srlPacket.deserialise(recvPacket))
215 return;
216
217 const auto playerInfo = sObjectMgr.getCachedCharacterInfo(srlPacket.guid.getGuidLow());
218 if (playerInfo == nullptr)
219 return;
220
221 auto result = CharacterDatabase.Query("SELECT login_flags FROM characters WHERE guid = %u AND acct = %u",
222 srlPacket.guid.getGuidLow(), _accountId);
223 if (result == nullptr)
224 return;
225
226 const auto loginErrorCode = VerifyName(srlPacket.name);
227 if (loginErrorCode != E_CHAR_NAME_SUCCESS)
228 {
229 SendPacket(SmsgCharRename(srlPacket.size, loginErrorCode, srlPacket.guid, srlPacket.name).serialise().get());
230 return;
231 }
232
233 auto result2 = CharacterDatabase.Query("SELECT COUNT(*) FROM banned_names WHERE name = '%s'",
234 CharacterDatabase.EscapeString(srlPacket.name).c_str());
235 if (result2)
236 {
237 if (result2->Fetch()[0].asUint32() > 0)
238 {
239 SendPacket(SmsgCharRename(srlPacket.size, E_CHAR_NAME_PROFANE, srlPacket.guid, srlPacket.name).serialise().get());
240 return;
241 }
242 }
243
244 if (sObjectMgr.getCachedCharacterInfoByName(srlPacket.name) != nullptr)
245 {
246 SendPacket(SmsgCharRename(srlPacket.size, E_CHAR_CREATE_NAME_IN_USE, srlPacket.guid, srlPacket.name).serialise().get());
247 return;
248 }
249
250 std::string newName = srlPacket.name;
252 std::string oldName = playerInfo->name;
253 sObjectMgr.updateCachedCharacterInfoName(playerInfo, newName);
254
255 _player->setName(newName);
256
257 sPlrLog.writefromsession(this, "renamed character %s, %u (guid), to %s.", oldName.c_str(), playerInfo->guid, newName.c_str());
258
259 CharacterDatabase.WaitExecute("UPDATE characters SET name = '%s' WHERE guid = %u",
260 newName.c_str(), srlPacket.guid.getGuidLow());
261 CharacterDatabase.WaitExecute("UPDATE characters SET login_flags = %u WHERE guid = %u",
262 static_cast<uint32_t>(LOGIN_NO_FLAG), srlPacket.guid.getGuidLow());
263
264 SendPacket(SmsgCharRename(srlPacket.size, E_RESPONSE_SUCCESS, srlPacket.guid, newName).serialise().get());
265}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharterBuy()

void WorldSession::handleCharterBuy ( WorldPacket recvPacket)
private

Definition at line 756 of file GuildHandler.cpp.

757{
758 CmsgPetitionBuy srlPacket;
759 if (!srlPacket.deserialise(recvPacket))
760 return;
761
763 if (!creature)
764 {
765 Disconnect();
766 return;
767 }
768
769 if (!creature->isTabardDesigner())
770 {
771 if ((srlPacket.arenaIndex - 1) > 2)
772 return;
773
774 const auto arena_type = static_cast<uint8_t>(srlPacket.arenaIndex - 1);
775 if (_player->getArenaTeam(arena_type))
776 {
778 return;
779 }
780
781 const auto arenaTeam = sObjectMgr.getArenaTeamByName(srlPacket.name, arena_type);
782 if (arenaTeam != nullptr)
783 {
785 return;
786 }
787
788 if (sObjectMgr.getCharterByName(srlPacket.name, static_cast<CharterTypes>(srlPacket.arenaIndex)))
789 {
791 return;
792 }
793
794 if (_player->m_charters[srlPacket.arenaIndex])
795 {
797 return;
798 }
799
801 {
802 SendNotification("You must be at least level %u to buy Arena charter", PLAYER_ARENA_MIN_LEVEL);
803 return;
804 }
805
807 static uint32_t costs[] = { worldConfig.arena.charterCost2v2, worldConfig.arena.charterCost3v3, worldConfig.arena.charterCost5v5 };
808
809 if (!_player->hasEnoughCoinage(costs[arena_type]))
810 {
811 SendNotification("You do not have enough gold to purchase this charter");
812 return;
813 }
814
815 ItemProperties const* itemProperties = sMySQLStore.getItemProperties(item_ids[arena_type]);
816 if (itemProperties == nullptr)
817 return;
818
819 const SlotResult slotResult = _player->getItemInterface()->FindFreeInventorySlot(itemProperties);
820 if (slotResult.Result == 0)
821 {
823 return;
824 }
825
826 const uint8_t error = _player->getItemInterface()->CanReceiveItem(itemProperties, 1);
827 if (error)
828 {
829 _player->getItemInterface()->buildInventoryChangeError(nullptr, nullptr, error, item_ids[arena_type]);
830 }
831 else
832 {
833 auto item = sObjectMgr.createItem(item_ids[arena_type], _player);
834
835 auto const charter = sObjectMgr.createCharter(_player->getGuidLow(), static_cast<CharterTypes>(srlPacket.arenaIndex));
836 if (item == nullptr || charter == nullptr)
837 return;
838
839 charter->setGuildName(srlPacket.name);
840 charter->setItemGuid(item->getGuid());
841
842 charter->m_petitionSignerCount = srlPacket.signerCount;
843
844 item->setStackCount(1);
845 item->addFlags(ITEM_FLAG_SOULBOUND);
846 item->setEnchantmentId(0, charter->getId());
847 item->setPropertySeed(57813883);
848 auto* itemRawPtr = item.get();
849 const auto [addResult, _] = _player->getItemInterface()->AddItemToFreeSlot(std::move(item));
850 if (!addResult)
851 {
852 charter->destroy();
853 return;
854 }
855
856 charter->saveToDB();
857
859 _player->getItemInterface()->LastSearchItemSlot(), 1, itemRawPtr->getEntry(), itemRawPtr->getPropertySeed(), itemRawPtr->getRandomPropertiesId(), itemRawPtr->getStackCount());
860
861 _player->modCoinage(-static_cast<int32_t>(costs[arena_type]));
862 _player->m_charters[srlPacket.arenaIndex] = charter;
863 _player->saveToDB(false);
864 }
865 }
866 else
867 {
868 if (!_player->hasEnoughCoinage(worldConfig.guild.charterCost))
869 {
871 return;
872 }
873
874 Guild* guild = sGuildMgr.getGuildByName(srlPacket.name);
875 auto const charter = sObjectMgr.getCharterByName(srlPacket.name, CHARTER_TYPE_GUILD);
876 if (guild != nullptr || charter != nullptr)
877 {
879 return;
880 }
881
883 {
885 return;
886 }
887
888 ItemProperties const* itemProperties = sMySQLStore.getItemProperties(CharterEntry::Guild);
889 if (itemProperties == nullptr)
890 return;
891
892 const SlotResult slotResult = _player->getItemInterface()->FindFreeInventorySlot(itemProperties);
893 if (slotResult.Result == 0)
894 {
896 return;
897 }
898
899 const uint8_t error = _player->getItemInterface()->CanReceiveItem(sMySQLStore.getItemProperties(CharterEntry::Guild), 1);
900 if (error)
901 {
903 }
904 else
905 {
907
908 auto item = sObjectMgr.createItem(CharterEntry::Guild, _player);
909
910 auto const guildCharter = sObjectMgr.createCharter(_player->getGuidLow(), CHARTER_TYPE_GUILD);
911 if (item == nullptr || guildCharter == nullptr)
912 return;
913
914 guildCharter->setGuildName(srlPacket.name);
915 guildCharter->setItemGuid(item->getGuid());
916
917 guildCharter->m_petitionSignerCount = srlPacket.signerCount;
918
919 item->setStackCount(1);
920 item->addFlags(ITEM_FLAG_SOULBOUND);
921 item->setEnchantmentId(0, guildCharter->getId());
922 item->setPropertySeed(57813883);
923 auto* itemRawPtr = item.get();
924 const auto [addResult, _] = _player->getItemInterface()->AddItemToFreeSlot(std::move(item));
925 if (!addResult)
926 {
927 guildCharter->destroy();
928 return;
929 }
930
931 guildCharter->saveToDB();
932
934 _player->getItemInterface()->LastSearchItemSlot(), 1, itemRawPtr->getEntry(), itemRawPtr->getPropertySeed(), itemRawPtr->getRandomPropertiesId(), itemRawPtr->getStackCount());
935
936 _player->m_charters[CHARTER_TYPE_GUILD] = guildCharter;
937 _player->modCoinage(-1000);
938 _player->saveToDB(false);
939 }
940 }
941}
@ INV_ERR_NOT_ENOUGH_MONEY
@ CHARTER_TYPE_GUILD
@ SS_ALREADY_ARENA_CHARTER
@ SS_ALREADY_GUILD_CHARTER
@ SS_ALREADY_ARENA_TEAM
@ SS_PETITION_NAME_ALREADY_USED
@ SS_GUILD_NAME_ALREADY_IN_USE
bool isTabardDesigner() const
Definition Creature.cpp:266
uint8_t LastSearchItemSlot()
uint8_t LastSearchItemBagSlot()
void sendPlayObjectSoundPacket(uint64_t objectGuid, uint32_t soundId)
Definition Player.cpp:9661
std::array< Charter *, NUM_CHARTER_TYPES > m_charters
Definition Player.hpp:1273
const char * LocalizedWorldSrv(uint32_t id)
void systemMessage(const std::string &format, Args &&... args)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharterDecline()

void WorldSession::handleCharterDecline ( WorldPacket recvPacket)
private

Definition at line 602 of file GuildHandler.cpp.

603{
604 MsgPetitionDecline srlPacket;
605 if (!srlPacket.deserialise(recvPacket))
606 return;
607
608 auto const charter = sObjectMgr.getCharterByItemGuid(srlPacket.itemGuid);
609 if (charter == nullptr)
610 return;
611
612 Player* player = sObjectMgr.getPlayer(charter->getLeaderGuid());
613 if (player)
615}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharterOffer()

void WorldSession::handleCharterOffer ( WorldPacket recvPacket)
private

Definition at line 528 of file GuildHandler.cpp.

529{
530 CmsgOfferPetition srlPacket;
531 if (!srlPacket.deserialise(recvPacket))
532 return;
533
534 Player* pTarget = _player->getWorldMap()->getPlayer(srlPacket.playerGuid.getGuidLow());
535 const auto pCharter = sObjectMgr.getCharterByItemGuid(srlPacket.itemGuid);
536 if (pCharter == nullptr)
537 {
539 return;
540 }
541
542 if (pTarget == nullptr || pTarget->getTeam() != _player->getTeam() || (pTarget == _player && !worldConfig.player.isInterfactionGuildEnabled))
543 {
545 return;
546 }
547
548 if (!pTarget->canSignCharter(pCharter, _player))
549 {
551 return;
552 }
553
554 pTarget->getSession()->SendPacket(SmsgPetitionShowSignatures(srlPacket.itemGuid, pCharter->getLeaderGuid(), pCharter->getId(), pCharter->getSignatureCount(),
555 pCharter->getAvailableSlots(), pCharter->getSignatures()).serialise().get());
556}
@ SS_TARGET_WRONG_FACTION
@ SS_ITEM_NOT_FOUND
@ SS_CANNOT_SIGN_MORE_REASONS
bool canSignCharter(Charter const *charter, Player *requester)
Definition Player.cpp:7838
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharterQuery()

void WorldSession::handleCharterQuery ( WorldPacket recvPacket)
private

Definition at line 745 of file GuildHandler.cpp.

746{
747 CmsgPetitionQuery srlPacket;
748 if (!srlPacket.deserialise(recvPacket))
749 return;
750
751 if (auto const charter = sObjectMgr.getCharterByItemGuid(srlPacket.itemGuid))
752 SendPacket(SmsgPetitionQueryResponse(srlPacket.charterId, charter->getLeaderGuid(),
753 charter->getGuildName(), charter->getCharterType(), charter->getAvailableSlots()).serialise().get());
754}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharterRename()

void WorldSession::handleCharterRename ( WorldPacket recvPacket)
private

Definition at line 617 of file GuildHandler.cpp.

618{
619 MsgPetitionRename srlPacket;
620 if (!srlPacket.deserialise(recvPacket))
621 return;
622
623 auto const charter1 = sObjectMgr.getCharterByItemGuid(srlPacket.itemGuid);
624 if (charter1 == nullptr)
625 return;
626
627 Guild* guild = sGuildMgr.getGuildByName(srlPacket.name);
628 auto charter = sObjectMgr.getCharterByName(srlPacket.name, static_cast<CharterTypes>(charter1->getCharterType()));
629 if (charter || guild)
630 {
631 SendNotification("That name is in use by another guild.");
632 return;
633 }
634
635 charter = charter1;
636 charter->setGuildName(srlPacket.name);
637 charter->saveToDB();
638
639 SendPacket(MsgPetitionRename(srlPacket.itemGuid, srlPacket.name).serialise().get());
640}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharterShowListOpcode()

void WorldSession::handleCharterShowListOpcode ( WorldPacket recvPacket)
protected

Definition at line 205 of file NPCHandler.cpp.

206{
207 CmsgPetitionShowlist srlPacket;
208 if (!srlPacket.deserialise(recvPacket))
209 return;
210
211 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_CHARTER_SHOW_LIST: {} (guidLowPart)", srlPacket.guid.getGuidLowPart());
212
213 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
214 if (creature == nullptr)
215 return;
216
217 sendCharterRequest(creature);
218}
void sendCharterRequest(Creature *creature)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharterShowSignatures()

void WorldSession::handleCharterShowSignatures ( WorldPacket recvPacket)
private

Definition at line 517 of file GuildHandler.cpp.

518{
520 if (!srlPacket.deserialise(recvPacket))
521 return;
522
523 if (const auto charter = sObjectMgr.getCharterByItemGuid(srlPacket.itemGuid))
524 _player->getSession()->SendPacket(SmsgPetitionShowSignatures(srlPacket.itemGuid, charter->getLeaderGuid(), charter->getId(), charter->getSignatureCount(),
525 charter->getAvailableSlots(), charter->getSignatures()).serialise().get());
526}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharterSign()

void WorldSession::handleCharterSign ( WorldPacket recvPacket)
private

Definition at line 567 of file GuildHandler.cpp.

568{
569 CmsgPetitionSign srlPacket;
570 if (!srlPacket.deserialise(recvPacket))
571 return;
572
573 if (const auto charter = sObjectMgr.getCharterByItemGuid(srlPacket.itemGuid))
574 {
575 for (const uint32_t playerGuid : charter->getSignatures())
576 {
577 if (playerGuid == _player->getGuid())
578 {
581 return;
582 }
583 }
584
585 if (charter->isFull())
586 return;
587
588 charter->addSignature(_player->getGuidLow());
589 charter->saveToDB();
590 _player->m_charters[charter->getCharterType()] = charter;
591 _player->saveToDB(false);
592
593 Player* player = _player->getWorldMap()->getPlayer(charter->getLeaderGuid());
594 if (player == nullptr)
595 return;
596
598 SendPacket(SmsgPetitionSignResult(srlPacket.itemGuid, uint64_t(charter->getLeaderGuid()), PetitionSignResult::OK).serialise().get());
599 }
600}
@ SS_ALREADY_SIGNED_CHARTER
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCharterTurnInCharter()

void WorldSession::handleCharterTurnInCharter ( WorldPacket recvPacket)
private

\ todo: missing correct error message for arena charters

Definition at line 642 of file GuildHandler.cpp.

643{
644 CmsgTurnInPetition srlPacket;
645 if (!srlPacket.deserialise(recvPacket))
646 return;
647
648 const auto charter = sObjectMgr.getCharterByItemGuid(srlPacket.itemGuid);
649 if (charter == nullptr)
650 return;
651
652 if (charter->getCharterType() == CHARTER_TYPE_GUILD)
653 {
654 const auto playerCharter = _player->m_charters[CHARTER_TYPE_GUILD];
655 if (playerCharter == nullptr)
656 return;
657
658 if (playerCharter->getSignatureCount() < playerCharter->getNumberOfAvailableSlots() && worldConfig.guild.requireAllSignatures && !_player->getSession()->HasGMPermissions())
659 {
661 return;
662 }
663
664 auto* guild = sGuildMgr.createGuild(_player, playerCharter->getGuildName());
665 if (guild == nullptr)
666 {
667 return;
668 }
669
671 playerCharter->destroy();
672
674 sHookInterface.OnGuildCreate(_player, guild);
675 }
676 else
677 {
678 uint8_t type;
679
680 switch (charter->getCharterType())
681 {
683 type = ARENA_TEAM_TYPE_2V2;
684 break;
685
687 type = ARENA_TEAM_TYPE_3V3;
688 break;
689
691 type = ARENA_TEAM_TYPE_5V5;
692 break;
693
694 default:
695 SendNotification("Chartertype not allowed for Arena");
696 return;
697 }
698
699 if (_player->getArenaTeam(charter->getCharterType() - 1U) != nullptr)
700 {
702 return;
703 }
704
705 if (charter->getSignatureCount() < charter->getNumberOfAvailableSlots() && !_player->getSession()->HasGMPermissions())
706 {
707 ///\ todo: missing correct error message for arena charters
709 return;
710 }
711
712 ArenaTeamEmblem emblem{ .emblemStyle = srlPacket.icon, .emblemColour = srlPacket.iconColor,
713 .borderStyle = srlPacket.border, .borderColour = srlPacket.borderColor, .backgroundColour = srlPacket.background };
714
715 if (auto* const arenaTeam = sObjectMgr.createArenaTeam(type, _player, charter->getGuildName(), 1500, emblem))
716 {
717 // set up the leader
718 _player->setArenaTeam(arenaTeam->m_type, arenaTeam);
719
720 sObjectMgr.updateArenaTeamRankings();
721
722 // set up the members
723 for (const uint32_t playerGuid : charter->getSignatures())
724 {
725 if (const auto info = sObjectMgr.getCachedCharacterInfo(playerGuid))
726 {
727 if (arenaTeam->addMember(info))
728 {
729 if (const auto arenaMember = sObjectMgr.getPlayer(playerGuid))
730 arenaMember->setArenaTeam(arenaTeam->m_type, arenaTeam);
731 }
732 }
733 }
734
736 _player->m_charters[charter->getCharterType()] = nullptr;
737 charter->destroy();
738 }
739
740 }
741
743}
@ PETITION_ERROR_OK
@ PETITION_ERROR_NEED_MORE_SIGNATURES
@ ARENA_TEAM_TYPE_3V3
@ ARENA_TEAM_TYPE_2V2
@ ARENA_TEAM_TYPE_5V5
@ CHARTER_TYPE_ARENA_5V5
@ CHARTER_TYPE_ARENA_3V3
@ CHARTER_TYPE_ARENA_2V2
static void sendTurnInPetitionResult(WorldSession *pClient, uint32_t result)
Definition Guild.cpp:2244
bool SafeFullRemoveItemByGuid(uint64_t guid)
Removes the item safely by guid, supports full inventory.
uint32_t RemoveItemAmt(uint32_t id, uint32_t amt)
Removes a ammount of items from inventory.
uint32_t emblemStyle
Definition ArenaTeam.hpp:47
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChatChannelWatchOpcode()

void WorldSession::handleChatChannelWatchOpcode ( WorldPacket recvPacket)
protected

Definition at line 580 of file ChatHandler.cpp.

581{
582 CmsgSetChannelWatch srlPacket;
583 if (!srlPacket.deserialise(recvPacket))
584 return;
585
586 sLogger.debug("Unhandled... Player {} watch channel: {}", _player->getName(), srlPacket.name);
587}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleChatIgnoredOpcode()

void WorldSession::handleChatIgnoredOpcode ( WorldPacket recvPacket)
protected

Definition at line 567 of file ChatHandler.cpp.

568{
569 CmsgChatIgnored srlPacket;
570 if (!srlPacket.deserialise(recvPacket))
571 return;
572
573 const auto player = sObjectMgr.getPlayer(srlPacket.guid.getGuidLow());
574 if (player == nullptr || player->getSession() == nullptr)
575 return;
576
577 player->getSession()->SendPacket(SmsgMessageChat(CHAT_MSG_IGNORED, LANG_UNIVERSAL, 0, _player->getName(), _player->getGuid()).serialise().get());
578}
@ CHAT_MSG_IGNORED
@ LANG_UNIVERSAL
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleClearTradeItem()

void WorldSession::handleClearTradeItem ( WorldPacket recvPacket)
protected

Definition at line 550 of file TradeHandler.cpp.

551{
552 CmsgClearTradeItem srlPacket;
553 if (!srlPacket.deserialise(recvPacket))
554 return;
555
556 const auto tradeData = _player->getTradeData();
557 if (tradeData == nullptr)
558 return;
559
560 if (srlPacket.tradeSlot >= TRADE_SLOT_COUNT)
561 return;
562
563 tradeData->setTradeItem(TradeSlots(srlPacket.tradeSlot), nullptr);
564}
@ TRADE_SLOT_COUNT
void setTradeItem(TradeSlots slot, Item *item)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCompleteCinematic()

void WorldSession::handleCompleteCinematic ( WorldPacket )
protected

Definition at line 1060 of file MiscHandler.cpp.

1061{
1062 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_COMPLETE_CINEMATIC");
1063
1065}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleConvertGroupToRaidOpcode()

void WorldSession::handleConvertGroupToRaidOpcode ( WorldPacket )
private

Definition at line 769 of file GroupHandler.cpp.

770{
771 auto const group = _player->getGroup();
772 if (group == nullptr)
773 return;
774
775 if (group->GetLeader() != _player->m_playerInfo)
776 {
778 return;
779 }
780
781 group->ExpandToRaid();
782 SendPacket(SmsgPartyCommandResult(0, "", ERR_PARTY_NO_ERROR).serialise().get());
783}
@ ERR_PARTY_NO_ERROR
Definition Group.h:17
@ ERR_PARTY_YOU_ARE_NOT_LEADER
Definition Group.h:24
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCorpseQueryOpcode()

void WorldSession::handleCorpseQueryOpcode ( WorldPacket )
protected

Definition at line 186 of file QueryHandler.cpp.

187{
188 const auto corpse = sObjectMgr.getCorpseByOwner(_player->getGuidLow());
189 if (corpse == nullptr)
190 return;
191
192 const auto mapInfo = sMySQLStore.getWorldMapInfo(corpse->GetMapId());
193 if (mapInfo == nullptr || mapInfo->isWorldMap() || mapInfo->isBattlegroundOrArena())
194 {
195 SendPacket(MsgCorspeQuery(uint8_t(1), corpse->GetMapId(), corpse->GetPosition(), corpse->GetMapId(), uint32_t(0)).serialise().get());
196 }
197 else
198 {
199 // type INSTANCE_RAID, INSTANCE_DUNGEON, INSTANCE_MULTIMODE
200 SendPacket(MsgCorspeQuery(uint8_t(1), mapInfo->repopmapid,
201 LocationVector(mapInfo->repopx, mapInfo->repopy, mapInfo->repopz), corpse->GetMapId(), uint32_t(0)).serialise().get());
202 }
203}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCorpseReclaimOpcode()

void WorldSession::handleCorpseReclaimOpcode ( WorldPacket recvPacket)
protected

Definition at line 1136 of file MiscHandler.cpp.

1137{
1138 CmsgReclaimCorpse srlPacket;
1139 if (!srlPacket.deserialise(recvPacket))
1140 return;
1141
1142 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_RECLAIM_CORPSE");
1143
1144 if (srlPacket.guid.getRawGuid() == 0)
1145 return;
1146
1147 auto corpse = sObjectMgr.getCorpseByGuid(srlPacket.guid.getGuidLow());
1148 if (corpse == nullptr)
1149 return;
1150
1151 WoWGuid wowGuid;
1152 wowGuid.Init(corpse->getOwnerGuid());
1153
1154 if (wowGuid.getGuidLowPart() != _player->getGuidLow() && corpse->getFlags() == 5)
1155 {
1156 SendPacket(SmsgResurrectFailed(1).serialise().get());
1157 return;
1158 }
1159
1160 if (corpse->GetDistance2dSq(_player) > CORPSE_MINIMUM_RECLAIM_RADIUS_SQ)
1161 {
1162 SendPacket(SmsgResurrectFailed(1).serialise().get());
1163 return;
1164 }
1165
1166 if (time(nullptr) < corpse->getDeathClock() + CORPSE_RECLAIM_TIME)
1167 {
1168 SendPacket(SmsgResurrectFailed(1).serialise().get());
1169 return;
1170 }
1171
1172 _player->resurrect();
1174}
#define CORPSE_RECLAIM_TIME
#define CORPSE_MINIMUM_RECLAIM_RADIUS_SQ
void resurrect()
Definition Player.cpp:7671
uint32_t getMaxHealth() const
Definition Unit.cpp:625
void setHealth(uint32_t health)
Definition Unit.cpp:482
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCreatureQueryOpcode()

void WorldSession::handleCreatureQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 70 of file QueryHandler.cpp.

71{
72 CmsgCreatureQuery srlPacket;
73 if (!srlPacket.deserialise(recvData))
74 {
75 Disconnect();
76 return;
77 }
78
79 const auto creature_info = sMySQLStore.getCreatureProperties(srlPacket.entry);
80 if (!creature_info)
81 return;
82
83 const auto loc = (language > 0) ? sMySQLStore.getLocalizedCreature(srlPacket.entry, language) : nullptr;
84 const auto name = loc ? loc->name : creature_info->Name.c_str();
85 const auto subName = loc ? loc->subName : creature_info->SubName.c_str();
86
87 sLogger.debug("Received SMSG_CREATURE_QUERY_RESPONSE for entry: {}", srlPacket.entry);
88 SendPacket(SmsgCreatureQueryResponse(creature_info, srlPacket.entry, name, subName).serialise().get());
89}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDelFriendOpcode()

void WorldSession::handleDelFriendOpcode ( WorldPacket recvPacket)
protected

Definition at line 35 of file SocialHandler.cpp.

36{
37 CmsgDelFriend srlPacket;
38 if (!srlPacket.deserialise(recvPacket))
39 return;
40
41 _player->removeFromFriendList(static_cast<uint32_t>(srlPacket.guid));
42}
void removeFromFriendList(uint32_t guid)
Definition Player.cpp:9177
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDelIgnoreOpcode()

void WorldSession::handleDelIgnoreOpcode ( WorldPacket recvPacket)
protected

Definition at line 53 of file SocialHandler.cpp.

54{
55 CmsgDelIgnore srlPacket;
56 if (!srlPacket.deserialise(recvPacket))
57 return;
58
59 _player->removeFromIgnoreList(static_cast<uint32_t>(srlPacket.guid));
60}
void removeFromIgnoreList(uint32_t guid)
Definition Player.cpp:9341
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDestroyItemOpcode()

void WorldSession::handleDestroyItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 1150 of file ItemHandler.cpp.

1151{
1152 CmsgDestroyItem srlPacket;
1153 if (!srlPacket.deserialise(recvPacket))
1154 return;
1155
1156 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_DESTROY_ITEM SrcInv Slot: {} Src slot: {}", srlPacket.srcInventorySlot, srlPacket.srcSlot);
1157
1158 if (Item* srcItem = _player->getItemInterface()->GetInventoryItem(srlPacket.srcInventorySlot, srlPacket.srcSlot))
1159 {
1160 if (srcItem->isContainer())
1161 {
1162 if (const auto itemContainer = dynamic_cast<Container*>(srcItem))
1163 {
1164 if (itemContainer->hasItems())
1165 {
1167 return;
1168 }
1169 }
1170 }
1171
1172 if (srcItem->getItemProperties()->HasFlag(ITEM_FLAG_INDESTRUCTIBLE))
1173 {
1175 return;
1176 }
1177
1178 const uint8_t charterType = srcItem->getCharterTypeForEntry();
1179 if (charterType < NUM_CHARTER_TYPES)
1180 {
1181 if (auto const charter = _player->m_charters[charterType])
1182 {
1183 charter->destroy();
1184 }
1185
1186 _player->m_charters[charterType] = nullptr;
1187 }
1188
1189 auto pItem = _player->getItemInterface()->SafeRemoveAndRetreiveItemFromSlot(srlPacket.srcInventorySlot, srlPacket.srcSlot, false);
1190 if (!pItem)
1191 return;
1192
1193 for (uint8_t i = 0; i < CURRENT_SPELL_MAX; ++i)
1194 {
1195 if (_player->getCurrentSpell(CurrentSpellType(i)) != nullptr
1196 && _player->getCurrentSpell(CurrentSpellType(i))->getItemCaster() == pItem.get())
1197 {
1200 }
1201 }
1202
1203 pItem->deleteFromDB();
1204 }
1205}
@ ITEM_FLAG_INDESTRUCTIBLE
@ INV_ERR_CANT_DROP_SOULBOUND
@ INV_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDismissCritter()

void WorldSession::handleDismissCritter ( WorldPacket recvPacket)
protected

Definition at line 689 of file PetHandler.cpp.

690{
691#if VERSION_STRING > TBC
692 CmsgDismissCritter srlPacket;
693 if (!srlPacket.deserialise(recvPacket))
694 return;
695
696 if (_player->getCritterGuid() == 0)
697 {
698 sLogger.failure("Player {} sent dismiss companion packet, but player has no companion", _player->getGuidLow());
699 return;
700 }
701
702 if (_player->getCritterGuid() != srlPacket.guid.getRawGuid())
703 {
704 sLogger.failure("Player {} sent dismiss companion packet, but it doesn't match player's companion", _player->getGuidLow());
705 return;
706 }
707
708 const auto unit = _player->getWorldMapUnit(srlPacket.guid.getRawGuid());
709 if (unit != nullptr)
710 unit->Delete();
711
712 _player->setCritterGuid(0);
713#endif
714}
Unit * getWorldMapUnit(const uint64_t &guid) const
Definition Object.cpp:4578
void Delete()
Definition Object.hpp:682
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDismissVehicle()

void WorldSession::handleDismissVehicle ( WorldPacket recvPacket)
protected

Definition at line 19 of file VehicleHandler.cpp.

20{
21#if VERSION_STRING > TBC
22 uint64_t vehicleGUID = _player->getCharmGuid();
23
24 if (!vehicleGUID) // something wrong here...
25 {
26 recvPacket.rfinish(); // prevent warnings spam
27 return;
28 }
29
30 _player->obj_movement_info.readMovementInfo(recvPacket, recvPacket.GetOpcode());
31 _player->callExitVehicle();
32#endif
33}
uint64_t getCharmGuid() const
Definition Unit.cpp:380
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDismountOpcode()

void WorldSession::handleDismountOpcode ( WorldPacket )
protected

Definition at line 707 of file MiscHandler.cpp.

708{
709 if (_player->isOnTaxi())
710 return;
711
712 _player->dismount();
713}
void dismount(bool resummonPet=true)
Definition Unit.cpp:8602
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDuelAccepted()

void WorldSession::handleDuelAccepted ( WorldPacket )
protected

Definition at line 14 of file DuelHandler.cpp.

15{
16 const auto duelPlayer = _player->m_duelPlayer;
17 if (duelPlayer == nullptr)
18 return;
19
21 return;
22
24 return;
25
28
29 duelPlayer->m_duelStatus = DUEL_STATUS_INBOUNDS;
30 duelPlayer->m_duelState = DUEL_STATE_STARTED;
31
32 const uint32_t defaultDuelCountdown = 3000;
33
34 SendPacket(SmsgDuelCountdown(defaultDuelCountdown).serialise().get());
35 duelPlayer->sendPacket(SmsgDuelCountdown(defaultDuelCountdown).serialise().get());
36
37 _player->m_duelCountdownTimer = defaultDuelCountdown;
38
40}
@ EVENT_PLAYER_DUEL_COUNTDOWN
Definition EventMgr.h:57
@ EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT
Definition EventMgr.h:109
#define sEventMgr
Definition EventMgr.h:278
@ DUEL_STATE_FINISHED
@ DUEL_STATE_STARTED
@ DUEL_STATUS_INBOUNDS
Player * m_duelPlayer
Definition Player.hpp:1726
uint8_t m_duelStatus
Definition Player.hpp:1727
uint32_t m_duelCountdownTimer
Definition Player.hpp:1729
void handleDuelCountdown()
Definition Player.cpp:12099
uint8_t m_duelState
Definition Player.hpp:1728
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDuelCancelled()

void WorldSession::handleDuelCancelled ( WorldPacket )
protected

Definition at line 42 of file DuelHandler.cpp.

43{
44 const auto duelPlayer = _player->m_duelPlayer;
45 if (duelPlayer == nullptr)
46 return;
47
49 {
50 duelPlayer->endDuel(DUEL_WINNER_KNOCKOUT);
51 return;
52 }
53
54 SendPacket(SmsgDuelComplete(1).serialise().get());
55 duelPlayer->sendPacket(SmsgDuelComplete(1).serialise().get());
56
58}
@ DUEL_WINNER_KNOCKOUT
void endDuel(uint8_t condition)
Definition Player.cpp:11955
void cancelDuel()
Definition Player.cpp:12074
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleDungeonDifficultyOpcode()

void WorldSession::handleDungeonDifficultyOpcode ( WorldPacket recvPacket)
protected

Definition at line 483 of file MiscHandler.cpp.

484{
485 MsgSetDungeonDifficulty srlPacket;
486 if (!srlPacket.deserialise(recvPacket))
487 return;
488
490 return;
491
492 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_SET_DUNGEON_DIFFICULTY: {} (difficulty)", srlPacket.difficulty);
493
495 return;
496
497 // cannot reset while in an instance
498 WorldMap* map = _player->getWorldMap();
499 if (map && map->getBaseMap()->isInstanceMap())
500 return;
501
502 if (const auto group = _player->getGroup())
503 {
504 if (_player->isGroupLeader())
505 {
506 group->resetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player);
507 group->SetDungeonDifficulty(InstanceDifficulty::Difficulties(srlPacket.difficulty));
508 }
509 }
510 else
511 {
514 }
515}
@ INSTANCE_RESET_CHANGE_DIFFICULTY
bool isInstanceMap() const
Definition BaseMap.cpp:117
void resetInstances(uint8_t method, bool isRaid)
Definition Player.cpp:13046
void setDungeonDifficulty(uint8_t diff)
Definition Player.cpp:7236
uint8_t getDungeonDifficulty()
Definition Player.cpp:7241
bool isGroupLeader() const
Definition Player.cpp:7888
BaseMap * getBaseMap() const
Definition WorldMap.hpp:320
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleEmoteOpcode()

void WorldSession::handleEmoteOpcode ( WorldPacket recvPacket)
protected

Definition at line 534 of file ChatHandler.cpp.

535{
536 CmsgEmote srlPacket;
537 if (!srlPacket.deserialise(recvPacket))
538 return;
539
540 if (!_player->isAlive())
541 return;
542
543 _player->emote(static_cast<EmoteType>(srlPacket.emote));
544
545#if VERSION_STRING > TBC
546 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE, srlPacket.emote, 0, 0);
547#endif
548
549 uint64_t guid = _player->getGuid();
550 sQuestMgr.OnPlayerEmote(_player, srlPacket.emote, guid);
551}
EmoteType
void emote(EmoteType emote)
Definition Unit.cpp:7063
bool isAlive() const
Definition Unit.cpp:7871
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleEnabletaxiOpcode()

void WorldSession::handleEnabletaxiOpcode ( WorldPacket recvPacket)
protected

Definition at line 146 of file TaxiHandler.cpp.

147{
148#if VERSION_STRING > TBC
149 CmsgEnabletaxi srlPacket;
150 if (!srlPacket.deserialise(recvPacket))
151 return;
152
153 sLogger.debug("WORLD: Received CMSG_ENABLETAXI");
154
155 // cheating checks
156 Creature* unit = GetPlayer()->getCreatureWhenICanInteract(srlPacket.creatureGuid, UNIT_NPC_FLAG_TAXI);
157 if (!unit)
158 {
160 return;
161 }
162
163 // unknown taxi node case
164 if (sendLearnNewTaxiNode(unit))
165 return;
166
167 // known taxi node case
168 sendTaxiMenu(unit);
169#endif
170}
void sendTaxiMenu(Creature *unit)
bool sendLearnNewTaxiNode(Creature *unit)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleEnterVehicle()

void WorldSession::handleEnterVehicle ( WorldPacket recvPacket)
protected

Definition at line 249 of file VehicleHandler.cpp.

250{
251#if VERSION_STRING > TBC
252 CmsgPlayerVehicleEnter srlPacket;
253 if (!srlPacket.deserialise(recvPacket))
254 return;
255
256 const auto unit = _player->getWorldMap()->getUnit(srlPacket.guid);
257 if (unit == nullptr)
258 return;
259
261 return;
262
263 if (unit->getVehicleKit() == nullptr)
264 return;
265
266 _player->callEnterVehicle(unit);
267#endif
268}
#define MAX_INTERACTION_RANGE
Definition Object.hpp:61
bool isInRange(LocationVector location, float square_r) const
Definition Object.cpp:578
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleEquipmentSetDelete()

void WorldSession::handleEquipmentSetDelete ( WorldPacket recvPacket)
protected

Definition at line 3164 of file ItemHandler.cpp.

3165{
3166#if VERSION_STRING > TBC
3167 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_EQUIPMENT_SET_DELETE");
3168
3169 WoWGuid guid;
3170
3171 data >> guid;
3172
3174 sLogger.debug("Equipmentset with GUID {} was successfully deleted.", guid.getGuidLowPart());
3175 else
3176 sLogger.debug("Equipmentset with GUID {} couldn't be deleted.", guid.getGuidLowPart());
3177#endif
3178}
bool DeleteEquipmentSet(uint32_t setGUID)
Arcemu::EquipmentSetMgr m_EquipmentSets
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleEquipmentSetSave()

void WorldSession::handleEquipmentSetSave ( WorldPacket recvPacket)
protected

Definition at line 3122 of file ItemHandler.cpp.

3123{
3124#if VERSION_STRING > TBC
3125 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_EQUIPMENT_SET_SAVE");
3126
3127 WoWGuid guid;
3128
3129 data >> guid;
3130
3131 uint32_t setGUID = guid.getGuidLowPart();
3132
3133 if (setGUID == 0)
3134 setGUID = sObjectMgr.generateEquipmentSetId();
3135
3136 auto equipmentSet = std::make_unique<Arcemu::EquipmentSet>();
3137
3138 equipmentSet->SetGUID = setGUID;
3139
3140 data >> equipmentSet->SetID;
3141 data >> equipmentSet->SetName;
3142 data >> equipmentSet->IconName;
3143
3144 for (uint32_t i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
3145 {
3146 guid.Clear();
3147 data >> guid;
3148 equipmentSet->ItemGUID[i] = guid.getGuidLowPart();
3149 }
3150
3151 const auto setId = equipmentSet->SetID;
3152 if (_player->getItemInterface()->m_EquipmentSets.AddEquipmentSet(setGUID, std::move(equipmentSet)))
3153 {
3154 sLogger.debug("Player {} successfully stored equipment set {} at slot {} ", _player->getGuidLow(), setGUID, setId);
3155 _player->sendEquipmentSetSaved(setId, setGUID);
3156 }
3157 else
3158 {
3159 sLogger.debug("Player {} couldn't store equipment set {} at slot {} ", _player->getGuidLow(), setGUID, setId);
3160 }
3161#endif
3162}
@ EQUIPMENT_SLOT_END
@ EQUIPMENT_SLOT_START
bool AddEquipmentSet(uint32_t setGUID, std::unique_ptr< EquipmentSet > set)
void sendEquipmentSetSaved(uint32_t setId, uint32_t setGuid)
Definition Player.cpp:9757
void Clear()
Definition WoWGuid.h:165
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleEquipmentSetUse()

void WorldSession::handleEquipmentSetUse ( WorldPacket recvPacket)
protected

Definition at line 3049 of file ItemHandler.cpp.

3050{
3051#if VERSION_STRING > TBC
3052 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_EQUIPMENT_SET_USE");
3053
3054 WoWGuid guid;
3055 int8_t SrcBagID;
3056 uint8_t SrcSlotID;
3057 uint8_t result = 0;
3058
3059 for (int8_t i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
3060 {
3061 guid.Clear();
3062
3063 data >> guid;
3064 data >> SrcBagID;
3065 data >> SrcSlotID;
3066
3067 const uint64_t ItemGUID = guid.getRawGuid();
3068
3069 const auto item = _player->getItemInterface()->GetItemByGUID(ItemGUID);
3070 if (item == nullptr)
3071 {
3072 result = 1;
3073 continue;
3074 }
3075
3076 const int8_t destSlot = i;
3077 const int8_t destBag = static_cast<int8_t>(INVALID_BACKPACK_SLOT);
3078
3079 if (SrcBagID == destBag && (SrcSlotID == destSlot))
3080 continue;
3081
3082 auto dstslotitem = _player->getItemInterface()->GetInventoryItem(destSlot);
3083 if (dstslotitem == nullptr)
3084 {
3085 const int8_t equipError = _player->getItemInterface()->CanEquipItemInSlot(destBag, destSlot, item->getItemProperties(), false, false);
3086 if (equipError == INV_ERR_OK)
3087 {
3088 auto srcItemHolder = _player->getItemInterface()->SafeRemoveAndRetreiveItemFromSlot(SrcBagID, SrcSlotID, false);
3089 auto [itemResult, returnedItem] = _player->getItemInterface()->SafeAddItem(std::move(srcItemHolder), destBag, destSlot);
3090 if (itemResult != ADD_ITEM_RESULT_OK)
3091 {
3092 const auto [addItemResult, returnedItem2] = _player->getItemInterface()->SafeAddItem(std::move(returnedItem), SrcBagID, SrcSlotID);
3093 if (!addItemResult)
3094 {
3095 // TODO: if add fails, should item be sent in mail? now it's destroyed
3096 sLogger.failure("handleEquipmentSetUse", "Error while adding item {} to player {} twice", returnedItem2->getEntry(), _player->getName());
3097 result = 0;
3098 }
3099 else
3100 result = 1;
3101 }
3102 }
3103 else
3104 {
3105 result = 1;
3106 }
3107
3108 }
3109 else
3110 {
3111 // There is something equipped so we need to swap
3112 if (!_player->getItemInterface()->SwapItems(INVALID_BACKPACK_SLOT, destSlot, SrcBagID, SrcSlotID))
3113 result = 1;
3114 }
3115
3116 }
3117
3119#endif
3120}
const uint8_t INVALID_BACKPACK_SLOT
@ INV_ERR_OK
bool SwapItems(int8_t DstInvSlot, int8_t DstSlot, int8_t SrcInvSlot, int8_t SrcSlot)
void sendEquipmentSetUseResultPacket(uint8_t result)
Definition Player.cpp:9616
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleForceSpeedChangeAck()

void WorldSession::handleForceSpeedChangeAck ( WorldPacket recvPacket)
protected

Definition at line 478 of file MovementHandler.cpp.

479{
480#if VERSION_STRING < Cata
481 /* extract packet */
482 uint32_t unk1;
483 float newspeed;
484 Unit* mover = _player->m_controledUnit;
485
486 // continue parse packet
487
488 recvPacket >> unk1; // counter or moveEvent
489
490 MovementInfo movementInfo;
491 recvPacket >> movementInfo;
492
493 // now can skip not our packet
494 // TODO: following statement is always true -Appled
495 if (movementInfo.getGuid() != mover->getGuid())
496 {
497 recvPacket.rfinish(); // prevent warnings spam
498 return;
499 }
500
501 recvPacket >> newspeed;
502 /*----------------*/
503
504 // client ACK send one packet for mounted/run case and need skip all except last from its
505 // in other cases anti-cheat check can be fail in false case
506 UnitSpeedType move_type;
507 UnitSpeedType force_move_type;
508
509 static char const* move_type_name[MAX_SPEED_TYPE] = { "Walk", "Run", "RunBack", "Swim", "SwimBack", "TurnRate", "Flight", "FlightBack", "PitchRate" };
510
511 const auto opcode = sOpcodeTables.getInternalIdForHex(recvPacket.GetOpcode());
512 switch (opcode)
513 {
514 case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = TYPE_WALK; force_move_type = TYPE_WALK; break;
515 case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: move_type = TYPE_RUN; force_move_type = TYPE_RUN; break;
516 case CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK: move_type = TYPE_RUN_BACK; force_move_type = TYPE_RUN_BACK; break;
517 case CMSG_FORCE_SWIM_SPEED_CHANGE_ACK: move_type = TYPE_SWIM; force_move_type = TYPE_SWIM; break;
518 case CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK: move_type = TYPE_SWIM_BACK; force_move_type = TYPE_SWIM_BACK; break;
519 case CMSG_FORCE_TURN_RATE_CHANGE_ACK: move_type = TYPE_TURN_RATE; force_move_type = TYPE_TURN_RATE; break;
520 case CMSG_FORCE_FLIGHT_SPEED_CHANGE_ACK: move_type = TYPE_FLY; force_move_type = TYPE_FLY; break;
521 case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = TYPE_FLY_BACK; force_move_type = TYPE_FLY_BACK; break;
522 case CMSG_FORCE_PITCH_RATE_CHANGE_ACK: move_type = TYPE_PITCH_RATE; force_move_type = TYPE_PITCH_RATE; break;
523 default:
524 sLogger.failure("WorldSession::handleForceSpeedChangeAck: Unknown move type opcode: {}", recvPacket.GetOpcode());
525 return;
526 }
527
528 // skip all forced speed changes except last and unexpected
529 // in run/mounted case used one ACK and it must be skipped.m_forced_speed_changes[MOVE_RUN} store both.
530 if (_player->m_forced_speed_changes[force_move_type] > 0)
531 {
532 --_player->m_forced_speed_changes[force_move_type];
533 if (_player->m_forced_speed_changes[force_move_type] > 0)
534 return;
535 }
536
537 if (!_player->GetTransport() && std::fabs(_player->getSpeedRate(move_type, false) - newspeed) > 0.01f)
538 {
539 if (_player->getSpeedRate(move_type, false) > newspeed) // must be greater - just correct
540 {
541 _player->setSpeedRate(move_type, _player->getSpeedRate(move_type, false), false);
542 }
543 else // must be lesser - cheating
544 {
545 // handle something here
546 }
547 }
548#else // todo fix for cata / mop
549 sLogger.debug("Opcode {} ({}) received. This opcode is not known/implemented right now!",
550 sOpcodeTables.getNameForInternalId(recvPacket.GetOpcode()), recvPacket.GetOpcode());
551
552 recvPacket.rfinish();
553#endif
554}
@ CMSG_FORCE_PITCH_RATE_CHANGE_ACK
Definition Opcodes.hpp:1249
@ CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK
Definition Opcodes.hpp:272
@ CMSG_FORCE_TURN_RATE_CHANGE_ACK
Definition Opcodes.hpp:803
@ CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK
Definition Opcodes.hpp:982
@ CMSG_FORCE_SWIM_SPEED_CHANGE_ACK
Definition Opcodes.hpp:274
@ CMSG_FORCE_RUN_SPEED_CHANGE_ACK
Definition Opcodes.hpp:270
@ CMSG_FORCE_WALK_SPEED_CHANGE_ACK
Definition Opcodes.hpp:799
@ CMSG_FORCE_FLIGHT_SPEED_CHANGE_ACK
Definition Opcodes.hpp:980
@ CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK
Definition Opcodes.hpp:801
UnitSpeedType
@ MAX_SPEED_TYPE
@ TYPE_RUN_BACK
@ TYPE_SWIM_BACK
@ TYPE_SWIM
@ TYPE_WALK
@ TYPE_RUN
@ TYPE_TURN_RATE
@ TYPE_FLY_BACK
@ TYPE_PITCH_RATE
@ TYPE_FLY
Transporter * GetTransport() const
Definition Object.hpp:379
uint8_t m_forced_speed_changes[MAX_SPEED_TYPE]
Definition Unit.hpp:633
float getSpeedRate(UnitSpeedType type, bool current) const
Definition Unit.cpp:2549
void setSpeedRate(UnitSpeedType mtype, float rate, bool current)
Definition Unit.cpp:2668
Unit * m_controledUnit
Definition Unit.hpp:694
ObjectGuid const & getGuid() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleFriendListOpcode()

void WorldSession::handleFriendListOpcode ( WorldPacket recvPacket)
protected

Definition at line 17 of file SocialHandler.cpp.

18{
19 CmsgContactList srlPacket;
20 if (!srlPacket.deserialise(recvPacket))
21 return;
22
24}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGameObjectQueryOpcode()

void WorldSession::handleGameObjectQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 49 of file QueryHandler.cpp.

50{
51 CmsgGameobjectQuery srlPacket;
52 if (!srlPacket.deserialise(recvData))
53 {
54 Disconnect();
55 return;
56 }
57
58 const auto gameobject_info = sMySQLStore.getGameObjectProperties(srlPacket.entry);
59 if (!gameobject_info)
60 return;
61
62 const auto loc = (language > 0) ? sMySQLStore.getLocalizedGameobject(srlPacket.entry, language) : nullptr;
63 const auto name = loc ? loc->name : gameobject_info->name.c_str();
64
65
66 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_GAMEOBJECT_QUERY for entry: {}", srlPacket.entry);
67 SendPacket(SmsgGameobjectQueryResponse(*gameobject_info, name).serialise().get());
68}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGameObjectUse()

void WorldSession::handleGameObjectUse ( WorldPacket recvPacket)
protected

Definition at line 1879 of file MiscHandler.cpp.

1880{
1881 CmsgGameobjUse srlPacket;
1882 if (!srlPacket.deserialise(recvPacket))
1883 return;
1884
1885 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_GAMEOBJ_USE: {} (gobj guidLow)", srlPacket.guid.getGuidLowPart());
1886
1887 auto gameObject = _player->getWorldMap()->getGameObject(srlPacket.guid.getGuidLowPart());
1888 if (!gameObject)
1889 return;
1890
1891 const auto gameObjectProperties = gameObject->GetGameObjectProperties();
1892 if (!gameObjectProperties)
1893 return;
1894
1895 //////////////////////////////////////////////////////////////////////////////////////////
1896 //\brief: the following lines are handled in gobj class
1897
1898 sObjectMgr.checkForScripts(_player, gameObjectProperties->raw.parameter_9);
1899
1900 if (gameObject->GetScript())
1901 gameObject->GetScript()->OnActivate(_player);
1902
1905
1907
1908 switch (gameObject->getGoType())
1909 {
1924 gameObject->onUse(_player);
1925 break;
1926 default:
1927 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_GAMEOBJ_USE for unhandled type {}.", gameObject->getGoType());
1928 break;
1929 }
1930}
@ SPELL_AURA_MOD_STEALTH
@ GAMEOBJECT_TYPE_CAMERA
@ GAMEOBJECT_TYPE_BUTTON
@ GAMEOBJECT_TYPE_MEETINGSTONE
@ GAMEOBJECT_TYPE_CHEST
@ GAMEOBJECT_TYPE_FLAGDROP
@ GAMEOBJECT_TYPE_QUESTGIVER
@ GAMEOBJECT_TYPE_SPELLCASTER
@ GAMEOBJECT_TYPE_FLAGSTAND
@ GAMEOBJECT_TYPE_CHAIR
@ GAMEOBJECT_TYPE_GOOBER
@ GAMEOBJECT_TYPE_BARBER_CHAIR
@ GAMEOBJECT_TYPE_RITUAL
GameObjectProperties const * GetGameObjectProperties() const
virtual void OnGameObjectActivate(GameObject *, Player *)
void removeAllAurasByAuraEffect(AuraEffect effect, uint32_t skipSpell=0, bool removeOnlyEffect=false, uint64_t casterGuid=0, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
Definition Unit.cpp:5306
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGameobjReportUseOpCode()

void WorldSession::handleGameobjReportUseOpCode ( WorldPacket recvPacket)
protected

Definition at line 464 of file MiscHandler.cpp.

465{
466#if VERSION_STRING > TBC
467 CmsgGameobjReportUse srlPacket;
468 if (!srlPacket.deserialise(recvPacket))
469 return;
470
471 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_GAMEOBJ_REPORT_USE: {} (guid.low)", srlPacket.guid.getGuidLow());
472
473 const auto gameobject = _player->getWorldMap()->getGameObject(srlPacket.guid.getGuidLow());
474 if (gameobject == nullptr)
475 return;
476
477 sQuestMgr.OnGameObjectActivate(_player, gameobject);
478 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT, gameobject->getEntry(), 0, 0);
479
480#endif
481}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGetChannelMemberCount()

void WorldSession::handleGetChannelMemberCount ( WorldPacket recvPacket)
protected

Definition at line 52 of file ChannelHandler.cpp.

53{
55 if (!srlPacket.deserialise(recvPacket))
56 return;
57
58 const auto channel = sChannelMgr.getChannel(srlPacket.name, _player);
59 if (channel)
60 SendPacket(SmgsChannelMemberCount(srlPacket.name, channel->getChannelFlags(), uint32_t(channel->getMemberCount())).serialise().get());
61}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGetMailOpcode()

void WorldSession::handleGetMailOpcode ( WorldPacket )
protected

Definition at line 216 of file MailHandler.cpp.

217{
219 uint32_t realCount = 0;
220 uint8_t count = 0;
221
222#if VERSION_STRING > TBC
223 data << uint32_t(0);
224#endif
225 data << uint8_t(0);
226
227 for (auto& message : _player->m_mailBox->Messages)
228 {
229 if (message.second.expire_time && static_cast<uint32_t>(UNIXTIME) > message.second.expire_time)
230 continue;
231
232 if (static_cast<uint32_t>(UNIXTIME) < message.second.delivery_time)
233 continue;
234
235 if (count >= 50)
236 {
237 ++realCount;
238 continue;
239 }
240
241 uint8_t guidSize;
242 if (message.second.message_type == 0)
243 guidSize = 8;
244 else
245 guidSize = 4;
246#if VERSION_STRING <= TBC
247 const size_t messageSize = 2 + 4 + 1 + guidSize + 4 * 8 + (message.second.subject.size() + 1) + 1 + (
248 message.second.items.size() * (1 + 4 + 4 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3 * 4 + 4 + 4 + 1 + 4 + 4 + 4));
249#elif VERSION_STRING < Cata
250 const size_t messageSize = 2 + 4 + 1 + guidSize + 4 * 8 + (message.second.subject.size() + 1) + (message.second.body.size() + 1) + 1 + (
251 message.second.items.size() * (1 + 4 + 4 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3 * 4 + 4 + 4 + 4 + 4 + 4 + 4 + 1));
252#else
253 const size_t messageSize = 2 + 4 + 1 + guidSize + 4 * 8 + (message.second.subject.size() + 1) + (message.second.body.size() + 1) + 1 + (
254 message.second.items.size() * (1 + 4 + 4 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3 * 4 + 4 + 4 + 4 + 4 + 4 + 4 + 1));
255#endif
256
257 data << uint16_t(messageSize);
258 data << uint32_t(message.second.message_id);
259 data << uint8_t(message.second.message_type);
260
261 switch (message.second.message_type)
262 {
263 case MAIL_TYPE_NORMAL:
264 data << uint64_t(message.second.sender_guid);
265 break;
266 case MAIL_TYPE_COD:
268 case MAIL_TYPE_ITEM:
269 data << uint32_t(WoWGuid::getGuidLowPartFromUInt64(message.second.sender_guid));
270 break;
273 data << uint32_t(static_cast<uint32_t>(message.second.sender_guid));
274 break;
275 }
276
277#if VERSION_STRING < Cata
278 data << uint32_t(message.second.cod);
279#else
280 data << uint64_t(message.second.cod);
281#endif
282#if VERSION_STRING < WotLK
283 uint32_t itemPageEntry = 0;
284 if (!message.second.body.empty())
285 {
286 itemPageEntry = sMySQLStore.getItemPageEntryByText(message.second.body);
287 if (itemPageEntry == 0)
288 {
289 itemPageEntry = sObjectMgr.generateItemPageEntry();
290 sMySQLStore.addItemPage(itemPageEntry, message.second.body);
291 }
292 }
293 data << uint32_t(itemPageEntry);
294
295#endif
296 data << uint32_t(0);
297 data << uint32_t(message.second.stationery);
298#if VERSION_STRING < Cata
299 data << uint32_t(message.second.money);
300#else
301 data << uint64_t(message.second.money);
302#endif
303 data << uint32_t(message.second.checked_flag);
304 data << float(float((message.second.expire_time - uint32_t(UNIXTIME)) / DAY));
305 data << uint32_t(0);
306
307 data << message.second.subject;
308#if VERSION_STRING > TBC
309 data << message.second.body;
310#endif
311
312 data << uint8_t(message.second.items.size());
313
314 uint8_t i = 0;
315 if (!message.second.items.empty())
316 {
317 for (auto itemEntry : message.second.items)
318 {
319 const auto item = sObjectMgr.loadItem(itemEntry);
320 if (item == nullptr)
321 continue;
322
323 data << uint8_t(i++);
324 data << uint32_t(item->getGuidLow());
325 data << uint32_t(item->getEntry());
326
327 for (uint8_t j = 0; j < MAX_INSPECTED_ENCHANTMENT_SLOT; ++j)
328 {
329 data << uint32_t(item->getEnchantmentId(j));
330 data << uint32_t(item->getEnchantmentDuration(j));
331 data << uint32_t(item->getEnchantmentCharges(j));
332 }
333
334 data << uint32_t(item->getRandomPropertiesId());
335 data << uint32_t(item->getPropertySeed());
336 data << uint32_t(item->getStackCount());
337 data << uint32_t(item->getChargesLeft());
338 data << uint32_t(item->getMaxDurability());
339 data << uint32_t(item->getDurability());
340 data << uint8_t(item->m_isLocked ? 1 : 0);
341 }
342 }
343 ++count;
344 ++realCount;
345 }
346#if VERSION_STRING > TBC
347 data.put<uint32_t>(0, realCount);
348 data.put<uint8_t>(4, count);
349#else
350 data.put<uint8_t>(0, count);
351#endif
352
353 SendPacket(&data);
354
355 // do cleanup on request mail
356 _player->m_mailBox->CleanupExpiredMessages();
357}
std::vector< AIMessagesArray > Messages
Definition AIUtils.hpp:31
@ MAX_INSPECTED_ENCHANTMENT_SLOT
@ MAIL_TYPE_CREATURE
Definition MailMgr.h:59
@ MAIL_TYPE_GAMEOBJECT
Definition MailMgr.h:60
@ MAIL_TYPE_NORMAL
Definition MailMgr.h:56
@ MAIL_TYPE_ITEM
Definition MailMgr.h:61
@ MAIL_TYPE_COD
Definition MailMgr.h:57
@ SMSG_MAIL_LIST_RESULT
Definition Opcodes.hpp:631
std::unique_ptr< Mailbox > m_mailBox
Definition Player.hpp:2188
@ DAY
Definition Definitions.h:14
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGMSurveySubmitOpcode()

void WorldSession::handleGMSurveySubmitOpcode ( WorldPacket recvPacket)
protected

Definition at line 59 of file GMTicketHandler.cpp.

60{
61 CmsgGmSurveySubmit srlPacket;
62 if (!srlPacket.deserialise(recvPacket))
63 return;
64
65 auto result = CharacterDatabase.Query("SELECT MAX(survey_id) FROM gm_survey");
66 if (result == nullptr)
67 return;
68
69 uint32_t next_survey_id = result->Fetch()[0].asUint32() + 1;
70
71 for (auto subSurvey : srlPacket.subSurvey)
72 CharacterDatabase.Execute("INSERT INTO gm_survey_answers VALUES(%u , %u , %u)",
73 next_survey_id, subSurvey.subSurveyId, subSurvey.answerId);
74
75 CharacterDatabase.Execute("INSERT INTO gm_survey VALUES (%u, %u, %u, \'%s\', UNIX_TIMESTAMP(NOW()))",
76 next_survey_id, _player->getGuidLow(), srlPacket.mainSurveyId, CharacterDatabase.EscapeString(srlPacket.mainComment).c_str());
77
78 sLogger.debug("Player {} has submitted the gm suvey {} successfully.",
79 _player->getName(), next_survey_id);
80}
bool Execute(uint8_t effectIndex, Spell *pSpell)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGMTicketCreateOpcode()

void WorldSession::handleGMTicketCreateOpcode ( WorldPacket recvPacket)
protected

Definition at line 159 of file GMTicketHandler.cpp.

160{
161 CmsgGmTicketCreate srlPacket;
162 if (!srlPacket.deserialise(recvPacket))
163 return;
164
165#if VERSION_STRING > WotLK
166
167 // chatLog
168 std::string chatLog;
169 if (srlPacket.ticketCount && srlPacket.decompressedSize && srlPacket.decompressedSize < 0xFFFF)
170 {
171 const auto pos = static_cast<uint32_t>(recvPacket.rpos());
172 ByteBuffer dest;
173 dest.resize(srlPacket.decompressedSize);
174
175 uLongf realSize = srlPacket.decompressedSize;
176 if (uncompress(dest.contents(), &realSize, recvPacket.contents() + pos, static_cast<uLong>(recvPacket.size() - pos)) == Z_OK)
177 {
178 dest >> chatLog;
179 }
180 else
181 {
182 sLogger.failure("CMSG_GMTICKET_CREATE failed to uncompress packet.");
183 recvPacket.rfinish();
184 return;
185 }
186
187 recvPacket.rfinish();
188 }
189#endif
190
191 // Remove pending tickets
192 sTicketMgr.removeGMTicketByPlayer(_player->getGuid());
193
194 auto* ticket = sTicketMgr.createGMTicket(_player, srlPacket);
195
196 SendPacket(SmsgGmTicketCreate(GMTNoErrors).serialise().get());
197
198 // send message indicating new ticket
199 auto channel = sChannelMgr.getChannel(worldConfig.getGmClientChannelName(), _player);
200 if (channel != nullptr)
201 {
202 std::stringstream ss;
203#ifdef GM_TICKET_MY_MASTER_COMPATIBLE
204 ss << "GmTicket 5, ";
205 ss << ticket->name;
206#else
207 ss << "GmTicket:";
209 ss << ":" << ticket->guid;
210 ss << ":" << ticket->level;
211 ss << ":" << ticket->name;
212#endif
213 channel->say(_player, ss.str(), nullptr, true);
214 }
215}
@ GMTNoErrors
#define sTicketMgr
Definition TicketMgr.hpp:97
@ GM_TICKET_CHAT_OPCODE_NEWTICKET
Definition TicketMgr.hpp:45
void resize(size_t newsize)
Definition ByteBuffer.h:516
size_t rpos()
Definition ByteBuffer.h:406
uint8_t * contents()
Definition ByteBuffer.h:495
size_t size() const
Definition ByteBuffer.h:505
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGMTicketDeleteOpcode()

void WorldSession::handleGMTicketDeleteOpcode ( WorldPacket )
protected

Definition at line 134 of file GMTicketHandler.cpp.

135{
136 GM_Ticket* ticket = sTicketMgr.getGMTicketByPlayer(_player->getGuid());
137
138 sTicketMgr.removeGMTicketByPlayer(_player->getGuid());
139
141
142 auto channel = sChannelMgr.getChannel(worldConfig.getGmClientChannelName(), _player);
143 if (channel != nullptr && ticket != nullptr)
144 {
145 std::stringstream ss;
146#ifdef GM_TICKET_MY_MASTER_COMPATIBLE
147 ss << "GmTicket 1,";
148 ss << ticket->name;
149#else
150 ss << "GmTicket:";
152 ss << ":";
153 ss << ticket->guid;
154#endif
155 channel->say(_player, ss.str(), nullptr, true);
156 }
157}
@ GMTTicketRemoved
@ GM_TICKET_CHAT_OPCODE_REMOVED
Definition TicketMgr.hpp:50
std::string name
Definition TicketMgr.hpp:30
uint64_t guid
Definition TicketMgr.hpp:28
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGMTicketGetTicketOpcode()

void WorldSession::handleGMTicketGetTicketOpcode ( WorldPacket )
protected

Definition at line 218 of file GMTicketHandler.cpp.

219{
220 if (const auto ticket = sTicketMgr.getGMTicketByPlayer(_player->getGuid()))
221 {
222 if (!ticket->deleted)
223 {
224 SendPacket(SmsgGmTicketGetTicket(GMTCurrentTicketFound, ticket->message, 0, ticket->guid, ticket->timestamp, ticket->comment).serialise().get());
225 }
226#if VERSION_STRING > WotLK
227 else
228 {
230 data << uint32_t(1); // unk
231 data << uint32_t(ticket->guid);
232 data << ticket->message.c_str();
233
234 size_t commentLength = ticket->comment.size();
235 char const* commentChars = ticket->comment.c_str();
236
237 for (int i = 0; i < 4; ++i)
238 {
239 if (commentLength)
240 {
241 size_t writeLen = std::min<size_t>(commentLength, 3999);
242 data.append(commentChars, writeLen);
243
244 commentLength -= writeLen;
245 commentChars += writeLen;
246 }
247
248 data << uint8_t(0);
249 }
250
251 SendPacket(&data);
252 }
253#endif
254 }
255 else
256 {
257 SendPacket(SmsgGmTicketGetTicket(GMTNoCurrentTicket, "", 0, 0, 0, "").serialise().get());
258 }
259}
@ GMTNoCurrentTicket
@ GMTCurrentTicketFound
@ SMSG_GMRESPONSE_RECEIVED
Definition Opcodes.hpp:1396
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGMTicketSystemStatusOpcode()

void WorldSession::handleGMTicketSystemStatusOpcode ( WorldPacket )
protected

Definition at line 48 of file GMTicketHandler.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGMTicketToggleSystemStatusOpcode()

void WorldSession::handleGMTicketToggleSystemStatusOpcode ( WorldPacket )
protected

Definition at line 53 of file GMTicketHandler.cpp.

54{
55 if (HasGMPermissions())
56 sWorld.toggleGmTicketStatus();
57}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGMTicketUpdateOpcode()

void WorldSession::handleGMTicketUpdateOpcode ( WorldPacket recvPacket)
protected

Definition at line 100 of file GMTicketHandler.cpp.

101{
102 CmsgGmTicketUpdateText srlPacket;
103 if (!srlPacket.deserialise(recvPacket))
104 return;
105
106 GM_Ticket* ticket = sTicketMgr.getGMTicketByPlayer(_player->getGuid());
107 if (ticket == nullptr)
108 {
110 }
111 else
112 {
113 ticket->message = srlPacket.message;
114 ticket->timestamp = static_cast<uint32_t>(UNIXTIME);
115 sTicketMgr.updateGMTicket(ticket);
116
118 }
119
120#ifndef GM_TICKET_MY_MASTER_COMPATIBLE
121 auto channel = sChannelMgr.getChannel(sWorld.getGmClientChannel(), _player);
122 if (channel != nullptr)
123 {
124 std::stringstream ss;
125 ss << "GmTicket:";
127 ss << ":";
128 ss << ticket->guid;
129 channel->say(_player, ss.str().c_str(), nullptr, true);
130 }
131#endif
132}
@ GMTNoTicketFound
@ GM_TICKET_CHAT_OPCODE_UPDATED
Definition TicketMgr.hpp:51
uint32_t timestamp
Definition TicketMgr.hpp:37
std::string message
Definition TicketMgr.hpp:36
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGossipHelloOpcode()

void WorldSession::handleGossipHelloOpcode ( WorldPacket recvPacket)
protected

Definition at line 229 of file NPCHandler.cpp.

230{
231 CmsgGossipHello srlPacket;
232 if (!srlPacket.deserialise(recvPacket))
233 return;
234
235 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_GOSSIP_HELLO: {} (guidLowPart)", srlPacket.guid.getGuidLowPart());
236
237 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
238 if (creature != nullptr)
239 {
240 // makes npc stop when for example on its waypoint path // aaron02
241 creature->pauseMovement(30000);
242 creature->SetSpawnLocation(creature->GetPosition());
243
244 if (_player->isStealthed())
246
247 _player->onTalkReputation(creature->m_factionEntry);
248
249 if (const auto script = GossipScript::getInterface(creature))
250 script->onHello(creature, _player);
251 }
252}
static GossipScript * getInterface(Creature *creature)
void onTalkReputation(WDB::Structures::FactionEntry const *factionEntry)
Definition Player.cpp:11689
bool isStealthed() const
Definition Unit.cpp:6205
void pauseMovement(uint32_t timer=0, uint8_t slot=0, bool forced=true)
Definition Unit.cpp:3013
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGossipSelectOptionOpcode()

void WorldSession::handleGossipSelectOptionOpcode ( WorldPacket recvPacket)
protected

Definition at line 255 of file NPCHandler.cpp.

256{
257 CmsgGossipSelectOption srlPacket;
258 if (!srlPacket.deserialise(recvPacket))
259 return;
260
261 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_GOSSIP_SELECT_OPTION: {} (gossipId), {} (option), {} (guidLow)",
262 srlPacket.gossip_id, srlPacket.option, srlPacket.guid.getGuidLow());
263
264
265 GossipScript* script = nullptr;
266 Object* object = nullptr;
267
268 switch (srlPacket.guid.getHigh())
269 {
270 case HighGuid::Item:
271 {
272 if (const auto item = _player->getItemInterface()->GetItemByGUID(srlPacket.guid))
273 {
274 script = GossipScript::getInterface(item);
275 object = item;
276 }
277 } break;
278 case HighGuid::Unit:
279 {
280 if (const auto creature = dynamic_cast<Creature*>(_player->getWorldMap()->getObject(srlPacket.guid)))
281 {
282 script = GossipScript::getInterface(creature);
283 object = creature;
284 }
285 } break;
287 {
288 if (const auto gameObject = dynamic_cast<GameObject*>(_player->getWorldMap()->getObject(srlPacket.guid)))
289 {
290 script = GossipScript::getInterface(gameObject);
291 object = gameObject;
292 }
293 } break;
294 default:
295 break;
296 }
297
298 if (script && object)
299 {
300 if (srlPacket.input.length() > 0)
301 script->onSelectOption(object, _player, srlPacket.option, srlPacket.input.c_str(), srlPacket.gossip_id);
302 else
303 script->onSelectOption(object, _player, srlPacket.option, nullptr, srlPacket.gossip_id);
304 }
305}
virtual void onSelectOption(Object *, Player *, uint32_t, const char *, uint32_t=0)
Object * getObject(const uint64_t &guid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupAcceptOpcode()

void WorldSession::handleGroupAcceptOpcode ( WorldPacket )
private

Definition at line 513 of file GroupHandler.cpp.

514{
515 if (_player->getGroup())
516 return;
517
518 const auto player = sObjectMgr.getPlayer(_player->getGroupInviterId());
519 if (player == nullptr)
520 return;
521
523 player->setGroupInviterId(0);
524
525 auto group = player->getGroup();
526 if (group == nullptr)
527 {
528 group = sObjectMgr.createGroup();
529 group->AddMember(player->getPlayerInfo());
530 group->AddMember(_player->getPlayerInfo());
531 group->m_difficulty = player->m_dungeonDifficulty;
532 _player->m_dungeonDifficulty = player->m_dungeonDifficulty;
534 }
535 else
536 {
537 group->AddMember(_player->getPlayerInfo());
538 _player->m_dungeonDifficulty = group->m_difficulty;
540 }
541}
CachedCharacterInfo * getPlayerInfo() const
Definition Player.cpp:2885
uint32_t getGroupInviterId() const
Definition Player.cpp:7882
void setGroupInviterId(uint32_t inviterId)
Definition Player.cpp:7881
uint8_t m_dungeonDifficulty
Definition Player.hpp:1168
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupAssistantLeader()

void WorldSession::handleGroupAssistantLeader ( WorldPacket recvPacket)
private

Definition at line 806 of file GroupHandler.cpp.

807{
808 const auto group = _player->getGroup();
809 if (group == nullptr)
810 return;
811
812 if (group->GetLeader() != _player->getPlayerInfo())
813 {
815 return;
816 }
817
818 CmsgGroupAssistantLeader srlPacket;
819 if (!srlPacket.deserialise(recvPacket))
820 return;
821
822 if (srlPacket.isActivated)
823 {
824 const auto playerInfo = sObjectMgr.getCachedCharacterInfo(srlPacket.guid.getGuidLow());
825 if (playerInfo == nullptr)
826 {
827 group->SetAssistantLeader(nullptr);
828 }
829 else
830 {
831 if (group->HasMember(playerInfo))
832 group->SetAssistantLeader(playerInfo);
833 }
834 }
835}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupChangeSubGroup()

void WorldSession::handleGroupChangeSubGroup ( WorldPacket recvPacket)
private

Definition at line 790 of file GroupHandler.cpp.

791{
792 CmsgGroupChangeSubGroup srlPacket;
793 if (!srlPacket.deserialise(recvPacket))
794 return;
795
796 const auto playerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.name);
797 if (playerInfo == nullptr || playerInfo->m_Group == nullptr)
798 return;
799
800 if (playerInfo->m_Group != _player->getGroup())
801 return;
802
803 _player->getGroup()->MovePlayer(playerInfo, srlPacket.subGroup);
804}
void MovePlayer(CachedCharacterInfo *info, uint8_t subgroup)
Definition Group.cpp:646
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupDeclineOpcode()

void WorldSession::handleGroupDeclineOpcode ( WorldPacket )
private

Definition at line 502 of file GroupHandler.cpp.

503{
504 const auto inviter = sObjectMgr.getPlayer(_player->getGroupInviterId());
505 if (inviter == nullptr)
506 return;
507
508 inviter->sendPacket(SmsgGroupDecline(_player->getName()).serialise().get());
509 inviter->setGroupInviterId(0);
511}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupDisbandOpcode()

void WorldSession::handleGroupDisbandOpcode ( WorldPacket )
private

Definition at line 615 of file GroupHandler.cpp.

616{
617 const auto group = _player->getGroup();
618 if (group == nullptr)
619 return;
620
621 if (group->getGroupType() & GROUP_TYPE_BG)
622 return;
623
625}
@ GROUP_TYPE_BG
Definition Group.h:32
void RemovePlayer(CachedCharacterInfo *info)
Definition Group.cpp:422
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupInviteOpcode()

void WorldSession::handleGroupInviteOpcode ( WorldPacket recvPacket)
private

Definition at line 240 of file GroupHandler.cpp.

241{
242#if VERSION_STRING >= Cata
243 ObjectGuid unk_guid;
244
245 recvPacket.read_skip<uint32_t>();
246 recvPacket.read_skip<uint32_t>();
247
248 unk_guid[2] = recvPacket.readBit();
249 unk_guid[7] = recvPacket.readBit();
250
251 uint8_t realm_name_length = static_cast<uint8_t>(recvPacket.readBits(9));
252
253 unk_guid[3] = recvPacket.readBit();
254
255 uint8_t member_name_length = static_cast<uint8_t>(recvPacket.readBits(10));
256
257 unk_guid[5] = recvPacket.readBit();
258 unk_guid[4] = recvPacket.readBit();
259 unk_guid[6] = recvPacket.readBit();
260 unk_guid[0] = recvPacket.readBit();
261 unk_guid[1] = recvPacket.readBit();
262
263 recvPacket.ReadByteSeq(unk_guid[4]);
264 recvPacket.ReadByteSeq(unk_guid[7]);
265 recvPacket.ReadByteSeq(unk_guid[6]);
266
267 std::string member_name = recvPacket.ReadString(member_name_length);
268 std::string realm_name = recvPacket.ReadString(realm_name_length);
269
270 recvPacket.ReadByteSeq(unk_guid[1]);
271 recvPacket.ReadByteSeq(unk_guid[0]);
272 recvPacket.ReadByteSeq(unk_guid[5]);
273 recvPacket.ReadByteSeq(unk_guid[3]);
274 recvPacket.ReadByteSeq(unk_guid[2]);
275
277 return;
278
279 Player* player = sObjectMgr.getPlayer(member_name.c_str(), false);
280 if (player == nullptr)
281 {
282 SendPacket(SmsgPartyCommandResult(0, member_name, ERR_PARTY_CANNOT_FIND).serialise().get());
283 return;
284 }
285
286 if (_player == player)
287 return;
288
290 {
292 return;
293 }
294
295 auto group = _player->getGroup();
296 if (group != nullptr)
297 {
298 if (group->IsFull())
299 {
300 SendPacket(SmsgPartyCommandResult(0, "", ERR_PARTY_IS_FULL).serialise().get());
301 return;
302 }
303 }
304
305 ObjectGuid inviter_guid = player->getGuid();
306
307 if (player->isInGroup())
308 {
311 data.writeBit(0);
312
313 data.writeBit(inviter_guid[0]);
314 data.writeBit(inviter_guid[3]);
315 data.writeBit(inviter_guid[2]);
316
317 data.writeBit(0); //not in group
318
319 data.writeBit(inviter_guid[6]);
320 data.writeBit(inviter_guid[5]);
321
322 data.writeBits(0, 9);
323
324 data.writeBit(inviter_guid[4]);
325
326 data.writeBits(strlen(_player->getName().c_str()), 7);
327
328 data.writeBits(0, 24);
329 data.writeBit(0);
330
331 data.writeBit(inviter_guid[1]);
332 data.writeBit(inviter_guid[7]);
333
334 data.flushBits();
335
336 data.WriteByteSeq(inviter_guid[1]);
337 data.WriteByteSeq(inviter_guid[4]);
338
339 data << int32_t(Util::getMSTime());
340 data << int32_t(0);
341 data << int32_t(0);
342
343 data.WriteByteSeq(inviter_guid[6]);
344 data.WriteByteSeq(inviter_guid[0]);
345 data.WriteByteSeq(inviter_guid[2]);
346 data.WriteByteSeq(inviter_guid[3]);
347 data.WriteByteSeq(inviter_guid[5]);
348 data.WriteByteSeq(inviter_guid[7]);
349
350 data.WriteString(_player->getName());
351
352 data << int32_t(0);
353
354 player->getSession()->SendPacket(&data);
355 return;
356 }
357
358 if (player->getTeam() != _player->getTeam() && !_player->getSession()->hasPermissions() && !sWorld.settings.player.isInterfactionGroupEnabled)
359 {
360 SendPacket(SmsgPartyCommandResult(0, member_name, ERR_PARTY_WRONG_FACTION).serialise().get());
361 return;
362 }
363
364 if (player->isAlreadyInvitedToGroup())
365 {
366 SendPacket(SmsgPartyCommandResult(0, member_name, ERR_PARTY_ALREADY_IN_GROUP).serialise().get());
367 return;
368 }
369
370 if (player->isIgnored(_player->getGuidLow()))
371 {
372 SendPacket(SmsgPartyCommandResult(0, member_name, ERR_PARTY_IS_IGNORING_YOU).serialise().get());
373 return;
374 }
375
376 if (player->isGMFlagSet() && !_player->getSession()->hasPermissions())
377 {
378 SendPacket(SmsgPartyCommandResult(0, member_name, ERR_PARTY_CANNOT_FIND).serialise().get());
379 return;
380 }
381
383 data.writeBit(0);
384
385 data.writeBit(inviter_guid[0]);
386 data.writeBit(inviter_guid[3]);
387 data.writeBit(inviter_guid[2]);
388
389 data.writeBit(1); //not in group
390
391 data.writeBit(inviter_guid[6]);
392 data.writeBit(inviter_guid[5]);
393
394 data.writeBits(0, 9);
395
396 data.writeBit(inviter_guid[4]);
397
398 data.writeBits(strlen(_player->getName().c_str()), 7);
399 data.writeBits(0, 24);
400 data.writeBit(0);
401
402 data.writeBit(inviter_guid[1]);
403 data.writeBit(inviter_guid[7]);
404
405 data.flushBits();
406
407 data.WriteByteSeq(inviter_guid[1]);
408 data.WriteByteSeq(inviter_guid[4]);
409
410 data << int32_t(Util::getMSTime());
411 data << int32_t(0);
412 data << int32_t(0);
413
414 data.WriteByteSeq(inviter_guid[6]);
415 data.WriteByteSeq(inviter_guid[0]);
416 data.WriteByteSeq(inviter_guid[2]);
417 data.WriteByteSeq(inviter_guid[3]);
418 data.WriteByteSeq(inviter_guid[5]);
419 data.WriteByteSeq(inviter_guid[7]);
420
421 data.WriteString(_player->getName());
422
423 data << int32_t(0);
424
425 player->getSession()->SendPacket(&data);
426
427 SendPacket(SmsgPartyCommandResult(0, member_name, ERR_PARTY_NO_ERROR).serialise().get());
428
430#else
431 CmsgGroupInvite srlPacket;
432 if (!srlPacket.deserialise(recvPacket))
433 return;
434
435 auto invitedPlayer = sObjectMgr.getPlayer(srlPacket.name.c_str(), false);
436 if (invitedPlayer == nullptr)
437 {
439 return;
440 }
441
442 if (invitedPlayer == _player || _player->isAlreadyInvitedToGroup())
443 return;
444
446 {
448 return;
449 }
450
451 if (_player->getGroup() != nullptr)
452 {
453 if (_player->getGroup()->IsFull())
454 {
455 SendPacket(SmsgPartyCommandResult(0, "", ERR_PARTY_IS_FULL).serialise().get());
456 return;
457 }
458 }
459
460 if (invitedPlayer->isInGroup())
461 {
462 SendPacket(SmsgPartyCommandResult(invitedPlayer->getGroup()->getGroupType(), srlPacket.name, ERR_PARTY_ALREADY_IN_GROUP).serialise().get());
463 invitedPlayer->getSession()->SendPacket(SmsgGroupInvite(0, _player->getName()).serialise().get());
464 return;
465 }
466
467 if (invitedPlayer->getTeam() != _player->getTeam() && !_player->getSession()->hasPermissions() && !worldConfig.player.isInterfactionGroupEnabled)
468 {
470 return;
471 }
472
473 if (invitedPlayer->isAlreadyInvitedToGroup())
474 {
476 return;
477 }
478
479 if (invitedPlayer->isIgnored(_player->getGuidLow()))
480 {
482 return;
483 }
484
485 if (invitedPlayer->isGMFlagSet() && !_player->getSession()->hasPermissions())
486 {
488 return;
489 }
490
491 invitedPlayer->getSession()->SendPacket(SmsgGroupInvite(1, _player->getName()).serialise().get());
492
494
495 invitedPlayer->setGroupInviterId(_player->getGuidLow());
496#endif
497}
@ ERR_PARTY_WRONG_FACTION
Definition Group.h:25
@ ERR_PARTY_IS_FULL
Definition Group.h:21
@ ERR_PARTY_IS_IGNORING_YOU
Definition Group.h:26
@ ERR_PARTY_CANNOT_FIND
Definition Group.h:18
@ ERR_PARTY_ALREADY_IN_GROUP
Definition Group.h:22
@ SMSG_GROUP_INVITE
Definition Opcodes.hpp:147
bool readBit()
Definition ByteBuffer.h:154
void ReadByteSeq(uint8_t &b)
Definition ByteBuffer.h:171
bool IsFull()
Definition Group.h:213
uint8_t getGroupType() const
Definition Group.h:222
bool isAlreadyInvitedToGroup() const
Definition Player.cpp:7883
bool isIgnored(uint32_t guid) const
Definition Player.cpp:9358
bool isInGroup() const
Definition Player.cpp:7885
bool isGMFlagSet() const
Definition Player.cpp:9381
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupInviteResponseOpcode()

void WorldSession::handleGroupInviteResponseOpcode ( WorldPacket recvPacket)
private

Definition at line 44 of file GroupHandler.cpp.

45{
46#if VERSION_STRING >= Cata
47 recvPacket.readBit(); //unk
48 bool acceptInvite = recvPacket.readBit();
49
50 if (acceptInvite)
51 {
52 if (_player->getGroup() != nullptr)
53 return;
54
55 Player* group_inviter = sObjectMgr.getPlayer(_player->getGroupInviterId());
56 if (!group_inviter)
57 return;
58
59 group_inviter->setGroupInviterId(0);
61
62 auto group = group_inviter->getGroup();
63 if (group != nullptr)
64 {
66 _player->m_dungeonDifficulty = group->m_difficulty;
68 }
69 else
70 {
71 group = sObjectMgr.createGroup();
72 group->m_difficulty = group_inviter->m_dungeonDifficulty;
73 group->AddMember(group_inviter->m_playerInfo);
74 group->AddMember(_player->m_playerInfo);
75 _player->m_dungeonDifficulty = group->m_difficulty;
77 }
78 }
79 else
80 {
81 Player* group_inviter = sObjectMgr.getPlayer(_player->getGroupInviterId());
82 if (group_inviter == nullptr)
83 return;
84
85 group_inviter->setGroupInviterId(0);
87
88 WorldPacket data(SMSG_GROUP_DECLINE, strlen(_player->getName().c_str()));
89 data << _player->getName().c_str();
90 group_inviter->getSession()->SendPacket(&data);
91 }
92#endif
93}
@ SMSG_GROUP_DECLINE
Definition Opcodes.hpp:152
bool AddMember(CachedCharacterInfo *info, int32_t subgroupid=-1)
Definition Group.cpp:128
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupPromote()

void WorldSession::handleGroupPromote ( WorldPacket recvPacket)
private

Definition at line 837 of file GroupHandler.cpp.

838{
839 const auto group = _player->getGroup();
840 if (group == nullptr)
841 return;
842
843 if (group->GetLeader() != _player->getPlayerInfo())
844 {
846 return;
847 }
848
849 MsgPartyAssign srlPacket;
850 if (!srlPacket.deserialise(recvPacket))
851 return;
852
853 CachedCharacterInfo* playerInfo = nullptr;
854
855 if (srlPacket.isActivated)
856 playerInfo = sObjectMgr.getCachedCharacterInfo(srlPacket.guid.getGuidLow());
857
858 if (srlPacket.promoteType == 1)
859 group->SetMainAssist(playerInfo);
860 else if (srlPacket.promoteType == 0)
861 group->SetMainTank(playerInfo);
862}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupRequestJoinUpdatesOpcode()

void WorldSession::handleGroupRequestJoinUpdatesOpcode ( WorldPacket )
private

Definition at line 187 of file GroupHandler.cpp.

188{
189#if VERSION_STRING >= Cata
190 auto group = _player->getGroup();
191 if (group != nullptr)
192 {
194 data << uint8_t(group->getGroupType());
195 data << uint32_t(group->GetMembersCount());
196 data << uint64_t(0); // unk
197 SendPacket(&data);
198 }
199#endif
200}
@ SMSG_REAL_GROUP_UPDATE
Definition Opcodes.hpp:1001
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupRoleCheckBeginOpcode()

void WorldSession::handleGroupRoleCheckBeginOpcode ( WorldPacket recvPacket)
private

Definition at line 202 of file GroupHandler.cpp.

203{
204#if VERSION_STRING >= Cata
205 auto group = _player->getGroup();
206 if (!group)
207 return;
208
209 if (recvPacket.isEmpty())
210 {
211 if (group->GetLeader()->guid != _player->getGuid() && group->GetMainAssist()->guid != _player->getGuid())
212 return;
213
214 ObjectGuid guid = _player->getGuid();
215
217 data.writeBit(guid[1]);
218 data.writeBit(guid[5]);
219 data.writeBit(guid[7]);
220 data.writeBit(guid[3]);
221 data.writeBit(guid[2]);
222 data.writeBit(guid[4]);
223 data.writeBit(guid[0]);
224 data.writeBit(guid[6]);
225
226 data.WriteByteSeq(guid[4]);
227 data.WriteByteSeq(guid[7]);
228 data.WriteByteSeq(guid[0]);
229 data.WriteByteSeq(guid[5]);
230 data.WriteByteSeq(guid[1]);
231 data.WriteByteSeq(guid[6]);
232 data.WriteByteSeq(guid[2]);
233 data.WriteByteSeq(guid[3]);
234
235 group->SendPacketToAll(&data);
236 }
237#endif
238}
@ SMSG_ROLE_CHECK_BEGIN
Definition Opcodes.hpp:1721
bool isEmpty() const
Definition ByteBuffer.h:511
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupSetLeaderOpcode()

void WorldSession::handleGroupSetLeaderOpcode ( WorldPacket recvPacket)
private

Definition at line 645 of file GroupHandler.cpp.

646{
647 CmsgGroupSetLeader srlPacket;
648 if (!srlPacket.deserialise(recvPacket))
649 return;
650
651 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_GROUP_SET_LEADER: {} (guidLow)", srlPacket.guid.getGuidLow());
652
653 const auto targetPlayer = sObjectMgr.getPlayer(srlPacket.guid.getGuidLow());
654 if (targetPlayer == nullptr)
655 {
657 return;
658 }
659
660 if (!_player->isGroupLeader())
661 {
663 return;
664 }
665
666 if (targetPlayer->getGroup() != _player->getGroup())
667 {
669 return;
670 }
671
672 const auto group = _player->getGroup();
673 if (group)
674 group->SetLeader(targetPlayer, false);
675}
@ ERR_PARTY_IS_NOT_IN_YOUR_PARTY
Definition Group.h:19
void SetLeader(Player *pPlayer, bool silent)
Definition Group.cpp:185
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupSetRolesOpcode()

void WorldSession::handleGroupSetRolesOpcode ( WorldPacket recvPacket)
private

Definition at line 95 of file GroupHandler.cpp.

96{
97#if VERSION_STRING >= Cata
98 uint32_t newRole;
99
100 recvPacket >> newRole;
101
102 ObjectGuid target_guid; // Target GUID
103 ObjectGuid player_guid = _player->getGuid();
104
105 target_guid[2] = recvPacket.readBit();
106 target_guid[6] = recvPacket.readBit();
107 target_guid[3] = recvPacket.readBit();
108 target_guid[7] = recvPacket.readBit();
109 target_guid[5] = recvPacket.readBit();
110 target_guid[1] = recvPacket.readBit();
111 target_guid[0] = recvPacket.readBit();
112 target_guid[4] = recvPacket.readBit();
113
114 recvPacket.ReadByteSeq(target_guid[6]);
115 recvPacket.ReadByteSeq(target_guid[4]);
116 recvPacket.ReadByteSeq(target_guid[1]);
117 recvPacket.ReadByteSeq(target_guid[3]);
118 recvPacket.ReadByteSeq(target_guid[0]);
119 recvPacket.ReadByteSeq(target_guid[5]);
120 recvPacket.ReadByteSeq(target_guid[2]);
121 recvPacket.ReadByteSeq(target_guid[7]);
122
124
125 data.writeBit(player_guid[1]);
126
127 data.writeBit(target_guid[0]);
128 data.writeBit(target_guid[2]);
129 data.writeBit(target_guid[4]);
130 data.writeBit(target_guid[7]);
131 data.writeBit(target_guid[3]);
132
133 data.writeBit(player_guid[7]);
134
135 data.writeBit(target_guid[5]);
136
137 data.writeBit(player_guid[5]);
138 data.writeBit(player_guid[4]);
139 data.writeBit(player_guid[3]);
140
141 data.writeBit(target_guid[6]);
142
143 data.writeBit(player_guid[2]);
144 data.writeBit(player_guid[6]);
145
146 data.writeBit(target_guid[1]);
147
148 data.writeBit(player_guid[0]);
149
150 data.WriteByteSeq(player_guid[7]);
151
152 data.WriteByteSeq(target_guid[3]);
153
154 data.WriteByteSeq(player_guid[6]);
155
156 data.WriteByteSeq(target_guid[4]);
157 data.WriteByteSeq(target_guid[0]);
158
159 data << uint32_t(newRole); // role
160
161 data.WriteByteSeq(target_guid[6]);
162 data.WriteByteSeq(target_guid[2]);
163
164 data.WriteByteSeq(player_guid[0]);
165 data.WriteByteSeq(player_guid[4]);
166
167 data.WriteByteSeq(target_guid[1]);
168
169 data.WriteByteSeq(player_guid[3]);
170 data.WriteByteSeq(player_guid[5]);
171 data.WriteByteSeq(player_guid[2]);
172
173 data.WriteByteSeq(target_guid[5]);
174 data.WriteByteSeq(target_guid[7]);
175
176 data.WriteByteSeq(player_guid[1]);
177
178 data << uint32_t(0); // unk
179
180 if (_player->getGroup())
182 else
183 SendPacket(&data);
184#endif
185}
@ SMSG_GROUP_SET_ROLE
Definition Opcodes.hpp:1624
void SendPacketToAll(WorldPacket *packet)
Definition Group.h:180
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupUninviteGuidOpcode()

void WorldSession::handleGroupUninviteGuidOpcode ( WorldPacket recvPacket)
private

Definition at line 578 of file GroupHandler.cpp.

579{
580 CmsgGroupUninviteGuid srlPacket;
581 if (!srlPacket.deserialise(recvPacket))
582 return;
583
584 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_GROUP_UNINVITE_GUID: {} (guidLow)", srlPacket.guid.getGuidLow());
585
586 const auto uninvitePlayer = sObjectMgr.getPlayer(srlPacket.guid.getGuidLow());
587 if (uninvitePlayer == nullptr)
588 {
589 SendPacket(SmsgPartyCommandResult(0, "unknown", ERR_PARTY_CANNOT_FIND).serialise().get());
590 return;
591 }
592
593 const std::string name = uninvitePlayer->getName();
594
595 if (!_player->isInGroup() || uninvitePlayer->getPlayerInfo()->m_Group != _player->getGroup())
596 {
598 return;
599 }
600
601 if (!_player->isGroupLeader())
602 {
603 if (_player != uninvitePlayer)
604 {
606 return;
607 }
608 }
609
610 const auto group = _player->getGroup();
611 if (group)
612 group->RemovePlayer(uninvitePlayer->getPlayerInfo());
613}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGroupUninviteOpcode()

void WorldSession::handleGroupUninviteOpcode ( WorldPacket recvPacket)
private

Definition at line 543 of file GroupHandler.cpp.

544{
545 CmsgGroupUninvite srlPacket;
546 if (!srlPacket.deserialise(recvPacket))
547 return;
548
549 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_GROUP_UNINVITE: {} (name)", srlPacket.name);
550
551 const auto uninvitePlayer = sObjectMgr.getPlayer(srlPacket.name.c_str(), false);
552 if (uninvitePlayer == nullptr)
553 {
555 return;
556 }
557
558 if (!_player->isInGroup() || uninvitePlayer->getPlayerInfo()->m_Group != _player->getGroup())
559 {
561 return;
562 }
563
564 if (!_player->isGroupLeader())
565 {
566 if (_player != uninvitePlayer)
567 {
569 return;
570 }
571 }
572
573 const auto group = _player->getGroup();
574 if (group)
575 group->RemovePlayer(uninvitePlayer->getPlayerInfo());
576}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildAccept()

void WorldSession::handleGuildAccept ( WorldPacket )
private

Definition at line 137 of file GuildHandler.cpp.

138{
139 if (!_player->getGuildId())
140 if (Guild* guild = sGuildMgr.getGuildById(_player->getInvitedByGuildId()))
141 guild->handleAcceptMember(this);
142}
uint32_t getInvitedByGuildId() const
Definition Player.cpp:7864
uint32_t getGuildId() const
Definition Player.cpp:788
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildAddRank()

void WorldSession::handleGuildAddRank ( WorldPacket recvPacket)
private

Definition at line 239 of file GuildHandler.cpp.

240{
241 CmsgGuildAddRank srlPacket;
242 if (!srlPacket.deserialise(recvPacket))
243 return;
244
245 if (Guild* guild = _player->getGuild())
246 guild->handleAddNewRank(this, srlPacket.name);
247}
Guild * getGuild() const
Definition Player.cpp:7865
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildAssignRankOpcode()

void WorldSession::handleGuildAssignRankOpcode ( WorldPacket recvPacket)
private

Definition at line 943 of file GuildHandler.cpp.

944{
945#if VERSION_STRING >= Cata
946 ObjectGuid targetGuid;
947 ObjectGuid setterGuid;
948
949 uint32_t rankId;
950 recvPacket >> rankId;
951
952 targetGuid[1] = recvPacket.readBit();
953 targetGuid[7] = recvPacket.readBit();
954
955 setterGuid[4] = recvPacket.readBit();
956 setterGuid[2] = recvPacket.readBit();
957
958 targetGuid[4] = recvPacket.readBit();
959 targetGuid[5] = recvPacket.readBit();
960 targetGuid[6] = recvPacket.readBit();
961
962 setterGuid[1] = recvPacket.readBit();
963 setterGuid[7] = recvPacket.readBit();
964
965 targetGuid[2] = recvPacket.readBit();
966 targetGuid[3] = recvPacket.readBit();
967 targetGuid[0] = recvPacket.readBit();
968
969 setterGuid[6] = recvPacket.readBit();
970 setterGuid[3] = recvPacket.readBit();
971 setterGuid[0] = recvPacket.readBit();
972 setterGuid[5] = recvPacket.readBit();
973
974 recvPacket.ReadByteSeq(targetGuid[0]);
975
976 recvPacket.ReadByteSeq(setterGuid[1]);
977 recvPacket.ReadByteSeq(setterGuid[3]);
978 recvPacket.ReadByteSeq(setterGuid[5]);
979
980 recvPacket.ReadByteSeq(targetGuid[7]);
981 recvPacket.ReadByteSeq(targetGuid[3]);
982
983 recvPacket.ReadByteSeq(setterGuid[0]);
984
985 recvPacket.ReadByteSeq(targetGuid[1]);
986
987 recvPacket.ReadByteSeq(setterGuid[6]);
988
989 recvPacket.ReadByteSeq(targetGuid[2]);
990 recvPacket.ReadByteSeq(targetGuid[5]);
991 recvPacket.ReadByteSeq(targetGuid[4]);
992
993 recvPacket.ReadByteSeq(setterGuid[2]);
994 recvPacket.ReadByteSeq(setterGuid[4]);
995
996 recvPacket.ReadByteSeq(targetGuid[6]);
997
998 recvPacket.ReadByteSeq(setterGuid[7]);
999
1000 sLogger.debug("CMSG_GUILD_ASSIGN_MEMBER_RANK {}: Target: {} Rank: {}, Issuer: {}",
1002
1003 if (Guild* guild = _player->getGuild())
1004 guild->handleSetMemberRank(this, targetGuid, setterGuid, rankId);
1005#endif
1006}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildBankBuyTab()

void WorldSession::handleGuildBankBuyTab ( WorldPacket recvPacket)
private

Definition at line 182 of file GuildHandler.cpp.

183{
184 CmsgGuildBankBuyTab srlPacket;
185 if (!srlPacket.deserialise(recvPacket))
186 return;
187
188 if (Guild* guild = _player->getGuild())
189 guild->handleBuyBankTab(this, srlPacket.tabId);
190}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildBankDepositMoney()

void WorldSession::handleGuildBankDepositMoney ( WorldPacket recvPacket)
private

Definition at line 388 of file GuildHandler.cpp.

389{
391 if (!srlPacket.deserialise(recvPacket))
392 return;
393
394 //\todo HasGold requires an uint32_t
395 if (srlPacket.money && _player->hasEnoughCoinage(srlPacket.money))
396 if (Guild* guild = _player->getGuild())
397 guild->handleMemberDepositMoney(this, srlPacket.money);
398}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildBankerActivate()

void WorldSession::handleGuildBankerActivate ( WorldPacket recvPacket)
private

Definition at line 476 of file GuildHandler.cpp.

477{
478 CmsgGuildBankerActivate srlPacket;
479 if (!srlPacket.deserialise(recvPacket))
480 return;
481
482 const auto gameObject = _player->getWorldMap()->getGameObject(srlPacket.guid.getGuidLow());
483 if (gameObject == nullptr)
484 return;
485
486 Guild* guild = _player->getGuild();
487 if (guild == nullptr)
488 {
490 return;
491 }
492
493#if VERSION_STRING < Cata
494 guild->sendBankList(this, 0, false, false);
495#else
496 guild->sendBankList(this, 0, true, true);
497#endif
498}
@ GC_TYPE_VIEW_TAB
@ GC_ERROR_PLAYER_NOT_IN_GUILD
void sendBankList(WorldSession *session, uint8_t tabId, bool withContent, bool withTabInfo) const
Definition Guild.cpp:1905
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildBankLogQuery()

void WorldSession::handleGuildBankLogQuery ( WorldPacket recvPacket)
private

Definition at line 192 of file GuildHandler.cpp.

193{
194 MsgGuildBankLogQuery srlPacket;
195 if (!srlPacket.deserialise(recvPacket))
196 return;
197
198 if (Guild* guild = _player->getGuild())
199 guild->sendBankLog(this, srlPacket.tabId);
200}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildBankMoneyWithdrawn()

void WorldSession::handleGuildBankMoneyWithdrawn ( WorldPacket )
private

Definition at line 500 of file GuildHandler.cpp.

501{
502 if (Guild* guild = _player->getGuild())
503 guild->sendMoneyInfo(this);
504}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildBankQueryTab()

void WorldSession::handleGuildBankQueryTab ( WorldPacket recvPacket)
private

Definition at line 455 of file GuildHandler.cpp.

456{
457 CmsgGuildBankQueryTab srlPacket;
458 if (!srlPacket.deserialise(recvPacket))
459 return;
460
461 Guild* guild = _player->getGuild();
462 if (guild == nullptr)
463 return;
464
465 GuildBankTab* pTab = guild->getBankTab(srlPacket.tabId);
466 if (pTab == nullptr)
467 return;
468
469#if VERSION_STRING < Cata
470 guild->sendBankList(this, srlPacket.tabId, false, true);
471#else
472 guild->sendBankList(this, srlPacket.tabId, true, false);
473#endif
474}
GuildBankTab * getBankTab(uint8_t tabId)
Definition Guild.hpp:313
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildBankQueryText()

void WorldSession::handleGuildBankQueryText ( WorldPacket recvPacket)
private

Definition at line 431 of file GuildHandler.cpp.

432{
433#if VERSION_STRING < Cata
434 MsgQueryGuildBankText srlPacket;
435 if (!srlPacket.deserialise(recvPacket))
436 return;
437
438 if (Guild* guild = _player->getGuild())
439 guild->sendBankTabText(this, srlPacket.tabId);
440#endif
441}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildBankSwapItems()

void WorldSession::handleGuildBankSwapItems ( WorldPacket recvPacket)
private

Definition at line 411 of file GuildHandler.cpp.

412{
413 Guild* guild = _player->getGuild();
414 if (guild == nullptr)
415 {
416 recvPacket.rfinish();
417 return;
418 }
419
420 CmsgGuildBankSwapItems srlPacket;
421 if (!srlPacket.deserialise(recvPacket))
422 return;
423
424 if (srlPacket.bankToBank)
425 guild->swapItems(_player, srlPacket.tabId, srlPacket.slotId, srlPacket.destTabId, srlPacket.destSlotId, srlPacket.splitedAmount);
426 else
427 guild->swapItemsWithInventory(_player, srlPacket.toChar, srlPacket.tabId, srlPacket.slotId, srlPacket.playerBag, srlPacket.playerSlotId, srlPacket.splitedAmount);
428}
void swapItems(Player *player, uint8_t tabId, uint8_t slotId, uint8_t destTabId, uint8_t destSlotId, uint32_t splitedAmount)
Definition Guild.cpp:2254
void swapItemsWithInventory(Player *player, bool toChar, uint8_t tabId, uint8_t slotId, uint8_t playerBag, uint8_t playerSlotId, uint32_t splitedAmount)
Definition Guild.cpp:2302
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildBankUpdateTab()

void WorldSession::handleGuildBankUpdateTab ( WorldPacket recvPacket)
private

Definition at line 400 of file GuildHandler.cpp.

401{
402 CmsgGuildBankUpdateTab srlPacket;
403 if (!srlPacket.deserialise(recvPacket))
404 return;
405
406 if (!srlPacket.tabName.empty() && !srlPacket.tabIcon.empty())
407 if (Guild* guild = _player->getGuild())
408 guild->handleSetBankTabInfo(this, srlPacket.slot, srlPacket.tabName, srlPacket.tabIcon);
409}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildBankWithdrawMoney()

void WorldSession::handleGuildBankWithdrawMoney ( WorldPacket recvPacket)
private

Definition at line 378 of file GuildHandler.cpp.

379{
381 if (!srlPacket.deserialise(recvPacket))
382 return;
383
384 if (Guild* guild = _player->getGuild())
385 guild->handleMemberWithdrawMoney(this, srlPacket.money);
386}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildDecline()

void WorldSession::handleGuildDecline ( WorldPacket )
private

Definition at line 144 of file GuildHandler.cpp.

145{
148}
void setGuildId(uint32_t guildId)
Definition Player.cpp:796
void setInvitedByGuildId(uint32_t GuildId)
Definition Player.cpp:7863
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildDelRank()

void WorldSession::handleGuildDelRank ( WorldPacket recvPacket)
private

Definition at line 363 of file GuildHandler.cpp.

364{
365#if VERSION_STRING < Cata
366 if (Guild* guild = _player->getGuild())
367 guild->handleRemoveLowestRank(this);
368#else
369 CmsgGuildDelRank srlPacket;
370 if (!srlPacket.deserialise(recvPacket))
371 return;
372
373 if (Guild* guild = _player->getGuild())
374 guild->handleRemoveRank(this, static_cast<uint8_t>(srlPacket.rankId));
375#endif
376}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildDemote()

void WorldSession::handleGuildDemote ( WorldPacket recvPacket)
private

Definition at line 299 of file GuildHandler.cpp.

300{
301 CmsgGuildDemote srlPacket;
302 if (!srlPacket.deserialise(recvPacket))
303 return;
304
305#if VERSION_STRING < Cata
306 const auto targetPlayerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.name);
307 if (targetPlayerInfo == nullptr)
308 return;
309
310 if (Guild* guild = _player->getGuild())
311 guild->handleUpdateMemberRank(this, targetPlayerInfo->guid, true);
312#else
313 if (Guild* guild = _player->getGuild())
314 guild->handleUpdateMemberRank(this, srlPacket.guid, true);
315#endif
316}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildDisband()

void WorldSession::handleGuildDisband ( WorldPacket )
private

Definition at line 164 of file GuildHandler.cpp.

165{
166 if (Guild* guild = _player->getGuild())
167 guild->handleDisband(this);
168}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildFinderAddRecruit()

void WorldSession::handleGuildFinderAddRecruit ( WorldPacket recvPacket)
private

Definition at line 1254 of file GuildHandler.cpp.

1255{
1256#if VERSION_STRING >= Cata
1257 if (sGuildFinderMgr.getAllMembershipRequestsForPlayer(_player->getGuidLow()).size() == 10)
1258 return;
1259
1260 uint32_t classRoles = 0;
1261 uint32_t availability = 0;
1262 uint32_t guildInterests = 0;
1263
1264 recvPacket >> classRoles;
1265 recvPacket >> guildInterests;
1266 recvPacket >> availability;
1267
1268 ObjectGuid guid;
1269
1270 guid[3] = recvPacket.readBit();
1271 guid[0] = recvPacket.readBit();
1272 guid[6] = recvPacket.readBit();
1273 guid[1] = recvPacket.readBit();
1274
1275 uint16_t commentLength = static_cast<uint16_t>(recvPacket.readBits(11));
1276
1277 guid[5] = recvPacket.readBit();
1278 guid[4] = recvPacket.readBit();
1279 guid[7] = recvPacket.readBit();
1280
1281 uint8_t nameLength = static_cast<uint8_t>(recvPacket.readBits(7));
1282
1283 guid[2] = recvPacket.readBit();
1284
1285 recvPacket.ReadByteSeq(guid[4]);
1286 recvPacket.ReadByteSeq(guid[5]);
1287
1288 std::string comment = recvPacket.ReadString(commentLength);
1289 std::string playerName = recvPacket.ReadString(nameLength);
1290
1291 recvPacket.ReadByteSeq(guid[7]);
1292 recvPacket.ReadByteSeq(guid[2]);
1293 recvPacket.ReadByteSeq(guid[0]);
1294 recvPacket.ReadByteSeq(guid[6]);
1295 recvPacket.ReadByteSeq(guid[1]);
1296 recvPacket.ReadByteSeq(guid[3]);
1297
1298 uint32_t guildLowGuid = WoWGuid::getGuidLowPartFromUInt64(uint64_t(guid));
1299
1300 if (!(classRoles & GUILDFINDER_ALL_ROLES) || classRoles > GUILDFINDER_ALL_ROLES)
1301 return;
1302
1303 if (!(availability & AVAILABILITY_ALWAYS) || availability > AVAILABILITY_ALWAYS)
1304 return;
1305
1306 if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
1307 return;
1308
1309 MembershipRequest request = MembershipRequest(_player->getGuidLow(), guildLowGuid, availability, classRoles, guildInterests, comment, time(nullptr));
1310 sGuildFinderMgr.addMembershipRequest(guildLowGuid, request);
1311#endif
1312}
@ ALL_INTERESTS
#define sGuildFinderMgr
@ GUILDFINDER_ALL_ROLES
@ AVAILABILITY_ALWAYS
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildFinderBrowse()

void WorldSession::handleGuildFinderBrowse ( WorldPacket recvPacket)
private

Definition at line 1314 of file GuildHandler.cpp.

1315{
1316#if VERSION_STRING >= Cata
1317 uint32_t classRoles = 0;
1318 uint32_t availability = 0;
1319 uint32_t guildInterests = 0;
1320 uint32_t playerLevel = 0;
1321
1322 recvPacket >> classRoles;
1323 recvPacket >> availability;
1324 recvPacket >> guildInterests;
1325 recvPacket >> playerLevel;
1326
1327 if (!(classRoles & GUILDFINDER_ALL_ROLES) || classRoles > GUILDFINDER_ALL_ROLES)
1328 return;
1329
1330 if (!(availability & AVAILABILITY_ALWAYS) || availability > AVAILABILITY_ALWAYS)
1331 return;
1332
1333 if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
1334 return;
1335
1336 if (playerLevel > worldConfig.player.playerLevelCap || playerLevel < 1)
1337 return;
1338
1339 Player* player = _player;
1340
1341 LFGuildPlayer settings(player->getGuidLow(), static_cast<uint8_t>(classRoles), static_cast<uint8_t>(availability), static_cast<uint8_t>(guildInterests), ANY_FINDER_LEVEL);
1342 LFGuildStore guildList = sGuildFinderMgr.getGuildsMatchingSetting(settings, player->getTeam());
1343 uint32_t guildCount = static_cast<uint32_t>(guildList.size());
1344
1345 if (guildCount == 0)
1346 {
1348 player->sendPacket(&packet);
1349 return;
1350 }
1351
1352 ByteBuffer bufferData(65 * guildCount);
1353 WorldPacket data(SMSG_LF_GUILD_BROWSE_UPDATED, 3 + guildCount * 65);
1354 data.writeBits(guildCount, 19);
1355
1356 for (LFGuildStore::const_iterator itr = guildList.begin(); itr != guildList.end(); ++itr)
1357 {
1358 LFGuildSettings guildSettings = itr->second;
1359 Guild* guild = sGuildMgr.getGuildById(itr->first);
1360
1361 ObjectGuid guildGUID = guild->getGUID();
1362
1363 data.writeBit(guildGUID[7]);
1364 data.writeBit(guildGUID[5]);
1365
1366 data.writeBits(guild->getName().size(), 8);
1367
1368 data.writeBit(guildGUID[0]);
1369
1370 data.writeBits(guildSettings.getComment().size(), 11);
1371
1372 data.writeBit(guildGUID[4]);
1373 data.writeBit(guildGUID[1]);
1374 data.writeBit(guildGUID[2]);
1375 data.writeBit(guildGUID[6]);
1376 data.writeBit(guildGUID[3]);
1377
1378 bufferData << uint32_t(guild->getEmblemInfo().getColor());
1379 bufferData << uint32_t(guild->getEmblemInfo().getBorderStyle());
1380 bufferData << uint32_t(guild->getEmblemInfo().getStyle());
1381
1382 bufferData.WriteString(guildSettings.getComment());
1383
1384 bufferData << uint8_t(0);
1385
1386 bufferData.WriteByteSeq(guildGUID[5]);
1387
1388 bufferData << uint32_t(guildSettings.getInterests());
1389
1390 bufferData.WriteByteSeq(guildGUID[6]);
1391 bufferData.WriteByteSeq(guildGUID[4]);
1392
1393 bufferData << uint32_t(guild->getLevel());
1394
1395 bufferData.WriteString(guild->getName());
1396
1397 bufferData << uint32_t(0); // Achievment
1398
1399 bufferData.WriteByteSeq(guildGUID[7]);
1400
1401 bufferData << uint8_t(sGuildFinderMgr.hasRequest(player->getGuidLow(), guild->getId()));
1402
1403 bufferData.WriteByteSeq(guildGUID[2]);
1404 bufferData.WriteByteSeq(guildGUID[0]);
1405
1406 bufferData << uint32_t(guildSettings.getAvailability());
1407
1408 bufferData.WriteByteSeq(guildGUID[1]);
1409
1410 bufferData << uint32_t(guild->getEmblemInfo().getBackgroundColor());
1411 bufferData << uint32_t(0);
1412 bufferData << uint32_t(guild->getEmblemInfo().getBorderColor());
1413 bufferData << uint32_t(guildSettings.getClassRoles());
1414
1415 bufferData.WriteByteSeq(guildGUID[3]);
1416 bufferData << uint32_t(guild->getMembersCount());
1417 }
1418
1419 data.flushBits();
1420 data.append(bufferData);
1421
1422 player->sendPacket(&data);
1423#endif
1424}
@ ANY_FINDER_LEVEL
std::map< uint32_t, LFGuildSettings > LFGuildStore
@ SMSG_LF_GUILD_BROWSE_UPDATED
Definition Opcodes.hpp:1671
uint32_t getBorderStyle() const
uint32_t getStyle() const
uint32_t getBorderColor() const
uint32_t getColor() const
uint32_t getBackgroundColor() const
std::string const & getName() const
Definition Guild.hpp:49
EmblemInfo const & getEmblemInfo() const
Definition Guild.hpp:284
uint32_t getId() const
Definition Guild.hpp:45
uint8_t getLevel() const
Definition Guild.hpp:57
uint64_t getGUID() const
Definition Guild.hpp:47
uint32_t getMembersCount() const
Definition Guild.hpp:271
uint8_t getClassRoles() const
std::string const & getComment() const
uint8_t getAvailability() const
uint8_t getInterests() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildFinderDeclineRecruit()

void WorldSession::handleGuildFinderDeclineRecruit ( WorldPacket recvPacket)
private

Definition at line 1426 of file GuildHandler.cpp.

1427{
1428#if VERSION_STRING >= Cata
1429 ObjectGuid playerGuid;
1430
1431 playerGuid[1] = recvPacket.readBit();
1432 playerGuid[4] = recvPacket.readBit();
1433 playerGuid[5] = recvPacket.readBit();
1434 playerGuid[2] = recvPacket.readBit();
1435 playerGuid[6] = recvPacket.readBit();
1436 playerGuid[7] = recvPacket.readBit();
1437 playerGuid[0] = recvPacket.readBit();
1438 playerGuid[3] = recvPacket.readBit();
1439
1440 recvPacket.ReadByteSeq(playerGuid[5]);
1441 recvPacket.ReadByteSeq(playerGuid[7]);
1442 recvPacket.ReadByteSeq(playerGuid[2]);
1443 recvPacket.ReadByteSeq(playerGuid[3]);
1444 recvPacket.ReadByteSeq(playerGuid[4]);
1445 recvPacket.ReadByteSeq(playerGuid[1]);
1446 recvPacket.ReadByteSeq(playerGuid[0]);
1447 recvPacket.ReadByteSeq(playerGuid[6]);
1448
1449 WoWGuid wowGuid;
1450 wowGuid.Init(playerGuid);
1451
1452 if (!wowGuid.isPlayer())
1453 return;
1454
1455 sGuildFinderMgr.removeMembershipRequest(wowGuid.getGuidLowPart(), _player->getGuildId());
1456#endif
1457}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildFinderGetApplications()

void WorldSession::handleGuildFinderGetApplications ( WorldPacket )
private

Definition at line 1459 of file GuildHandler.cpp.

1460{
1461#if VERSION_STRING >= Cata
1462 std::list<MembershipRequest> applicatedGuilds = sGuildFinderMgr.getAllMembershipRequestsForPlayer(_player->getGuidLow());
1463 uint32_t applicationsCount = static_cast<uint32_t>(applicatedGuilds.size());
1464 WorldPacket data(SMSG_LF_GUILD_MEMBERSHIP_LIST_UPDATED, 7 + 54 * applicationsCount);
1465 data.writeBits(applicationsCount, 20);
1466
1467 if (applicationsCount > 0)
1468 {
1469 ByteBuffer bufferData(54 * applicationsCount);
1470 for (std::list<MembershipRequest>::const_iterator itr = applicatedGuilds.begin(); itr != applicatedGuilds.end(); ++itr)
1471 {
1472 Guild* guild = sGuildMgr.getGuildById(itr->getGuildId());
1473 LFGuildSettings guildSettings = sGuildFinderMgr.getGuildSettings(itr->getGuildId());
1474 MembershipRequest request = *itr;
1475
1476 ObjectGuid guildGuid = ObjectGuid(guild->getGUID());
1477
1478 data.writeBit(guildGuid[1]);
1479 data.writeBit(guildGuid[0]);
1480 data.writeBit(guildGuid[5]);
1481
1482 data.writeBits(request.getComment().size(), 11);
1483
1484 data.writeBit(guildGuid[3]);
1485 data.writeBit(guildGuid[7]);
1486 data.writeBit(guildGuid[4]);
1487 data.writeBit(guildGuid[6]);
1488 data.writeBit(guildGuid[2]);
1489
1490 data.writeBits(guild->getName().size(), 8);
1491
1492 bufferData.WriteByteSeq(guildGuid[2]);
1493
1494 bufferData.WriteString(request.getComment());
1495
1496 bufferData.WriteByteSeq(guildGuid[5]);
1497
1498 bufferData.WriteString(guild->getName());
1499
1500 bufferData << uint32_t(guildSettings.getAvailability());
1501 bufferData << uint32_t(request.getExpiryTime() - time(nullptr));
1502
1503 bufferData.WriteByteSeq(guildGuid[0]);
1504 bufferData.WriteByteSeq(guildGuid[6]);
1505 bufferData.WriteByteSeq(guildGuid[3]);
1506 bufferData.WriteByteSeq(guildGuid[7]);
1507
1508 bufferData << uint32_t(guildSettings.getClassRoles());
1509
1510 bufferData.WriteByteSeq(guildGuid[4]);
1511 bufferData.WriteByteSeq(guildGuid[1]);
1512
1513 bufferData << uint32_t(time(nullptr) - request.getSubmitTime());
1514 bufferData << uint32_t(guildSettings.getInterests());
1515 }
1516
1517 data.flushBits();
1518 data.append(bufferData);
1519 }
1520 data << uint32_t(10 - sGuildFinderMgr.countRequestsFromPlayer(_player->getGuidLow()));
1521
1522 _player->sendPacket(&data);
1523#endif
1524}
@ SMSG_LF_GUILD_MEMBERSHIP_LIST_UPDATED
Definition Opcodes.hpp:1673
std::string const & getComment() const
time_t getExpiryTime() const
time_t getSubmitTime() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildFinderGetRecruits()

void WorldSession::handleGuildFinderGetRecruits ( WorldPacket recvPacket)
private

Definition at line 1526 of file GuildHandler.cpp.

1527{
1528#if VERSION_STRING >= Cata
1529 uint32_t unkTime = 0;
1530 recvPacket >> unkTime;
1531
1532 Player* player = _player;
1533 if (!player->getGuildId())
1534 return;
1535
1536 std::vector<MembershipRequest> recruitsList = sGuildFinderMgr.getAllMembershipRequestsForGuild(player->getGuildId());
1537 uint32_t recruitCount = static_cast<uint32_t>(recruitsList.size());
1538
1539 ByteBuffer dataBuffer(53 * recruitCount);
1540 WorldPacket data(SMSG_LF_GUILD_RECRUIT_LIST_UPDATED, 7 + 26 * recruitCount + 53 * recruitCount);
1541 data.writeBits(recruitCount, 20);
1542
1543 for (std::vector<MembershipRequest>::const_iterator itr = recruitsList.begin(); itr != recruitsList.end(); ++itr)
1544 {
1545 MembershipRequest request = *itr;
1546 WoWGuid playerGuid(request.getPlayerGUID(), 0, HIGHGUID_TYPE_PLAYER);
1547
1548 const auto* info = sObjectMgr.getCachedCharacterInfo(request.getPlayerGUID());
1549 std::string name = info->name;
1550
1551 data.writeBits(request.getComment().size(), 11);
1552
1553 data.writeBit(playerGuid[2]);
1554 data.writeBit(playerGuid[4]);
1555 data.writeBit(playerGuid[3]);
1556 data.writeBit(playerGuid[7]);
1557 data.writeBit(playerGuid[0]);
1558
1559 data.writeBits(name.size(), 7);
1560
1561 data.writeBit(playerGuid[5]);
1562 data.writeBit(playerGuid[1]);
1563 data.writeBit(playerGuid[6]);
1564
1565 dataBuffer.WriteByteSeq(playerGuid[4]);
1566
1567 dataBuffer << int32_t(time(nullptr) <= request.getExpiryTime());
1568
1569 dataBuffer.WriteByteSeq(playerGuid[3]);
1570 dataBuffer.WriteByteSeq(playerGuid[0]);
1571 dataBuffer.WriteByteSeq(playerGuid[1]);
1572
1573 dataBuffer << int32_t(info->lastLevel);
1574
1575 dataBuffer.WriteByteSeq(playerGuid[6]);
1576 dataBuffer.WriteByteSeq(playerGuid[7]);
1577 dataBuffer.WriteByteSeq(playerGuid[2]);
1578
1579 dataBuffer << int32_t(time(nullptr) - request.getSubmitTime());
1580 dataBuffer << int32_t(request.getAvailability());
1581 dataBuffer << int32_t(request.getClassRoles());
1582 dataBuffer << int32_t(request.getInterests());
1583 dataBuffer << int32_t(request.getExpiryTime() - time(nullptr));
1584
1585 dataBuffer.WriteString(name);
1586 dataBuffer.WriteString(request.getComment());
1587
1588 dataBuffer << int32_t(info->cl);
1589
1590 dataBuffer.WriteByteSeq(playerGuid[5]);
1591 }
1592
1593 data.flushBits();
1594 data.append(dataBuffer);
1595 data << uint32_t(time(nullptr));
1596
1597 player->sendPacket(&data);
1598#endif
1599}
@ SMSG_LF_GUILD_RECRUIT_LIST_UPDATED
Definition Opcodes.hpp:1675
@ HIGHGUID_TYPE_PLAYER
Definition WoWGuid.h:36
uint8_t getInterests() const
uint8_t getClassRoles() const
uint8_t getAvailability() const
uint32_t getPlayerGUID() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildFinderPostRequest()

void WorldSession::handleGuildFinderPostRequest ( WorldPacket )
private

Definition at line 1601 of file GuildHandler.cpp.

1602{
1603#if VERSION_STRING >= Cata
1604 Player* player = _player;
1605 if (!player->getGuildId())
1606 return;
1607
1608 bool isGuildMaster = true;
1609 if (Guild* guild = sGuildMgr.getGuildById(player->getGuildId()))
1610 {
1611 if (guild->getLeaderGUID() != player->getGuid())
1612 isGuildMaster = false;
1613 }
1614
1615 LFGuildSettings settings = sGuildFinderMgr.getGuildSettings(player->getGuildId());
1616
1618 data.writeBit(isGuildMaster);
1619
1620 if (isGuildMaster)
1621 {
1622 data.writeBits(settings.getComment().size(), 11);
1623
1624 data.writeBit(settings.isListed());
1625
1626 data << uint32_t(settings.getLevel());
1627
1628 data.WriteString(settings.getComment());
1629
1630 data << uint32_t(0);
1631
1632 data << uint32_t(settings.getAvailability());
1633 data << uint32_t(settings.getClassRoles());
1634 data << uint32_t(settings.getInterests());
1635 }
1636 else
1637 {
1638 data.flushBits();
1639 }
1640
1641 player->getSession()->SendPacket(&data);
1642#endif
1643}
@ SMSG_LF_GUILD_POST_UPDATED
Definition Opcodes.hpp:1674
uint8_t getLevel() const
bool isListed() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildFinderRemoveRecruit()

void WorldSession::handleGuildFinderRemoveRecruit ( WorldPacket recvPacket)
private

Definition at line 1645 of file GuildHandler.cpp.

1646{
1647#if VERSION_STRING >= Cata
1648 ObjectGuid guildGuid;
1649
1650 guildGuid[0] = recvPacket.readBit();
1651 guildGuid[4] = recvPacket.readBit();
1652 guildGuid[3] = recvPacket.readBit();
1653 guildGuid[5] = recvPacket.readBit();
1654 guildGuid[7] = recvPacket.readBit();
1655 guildGuid[6] = recvPacket.readBit();
1656 guildGuid[2] = recvPacket.readBit();
1657 guildGuid[1] = recvPacket.readBit();
1658
1659 recvPacket.ReadByteSeq(guildGuid[4]);
1660 recvPacket.ReadByteSeq(guildGuid[0]);
1661 recvPacket.ReadByteSeq(guildGuid[3]);
1662 recvPacket.ReadByteSeq(guildGuid[6]);
1663 recvPacket.ReadByteSeq(guildGuid[5]);
1664 recvPacket.ReadByteSeq(guildGuid[1]);
1665 recvPacket.ReadByteSeq(guildGuid[2]);
1666 recvPacket.ReadByteSeq(guildGuid[7]);
1667
1669#endif
1670}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildFinderSetGuildPost()

void WorldSession::handleGuildFinderSetGuildPost ( WorldPacket recvPacket)
private

Definition at line 1672 of file GuildHandler.cpp.

1673{
1674#if VERSION_STRING >= Cata
1675 uint32_t classRoles = 0;
1676 uint32_t availability = 0;
1677 uint32_t guildInterests = 0;
1678 uint32_t level = 0;
1679
1680 recvPacket >> level;
1681 recvPacket >> availability;
1682 recvPacket >> guildInterests;
1683 recvPacket >> classRoles;
1684
1685 if (level == 0)
1686 level = ANY_FINDER_LEVEL;
1687
1688 uint32_t length = recvPacket.readBits(11);
1689 bool listed = recvPacket.readBit();
1690 std::string comment = recvPacket.ReadString(length);
1691
1692 if (!(classRoles & GUILDFINDER_ALL_ROLES) || classRoles > GUILDFINDER_ALL_ROLES)
1693 return;
1694
1695 if (!(availability & AVAILABILITY_ALWAYS) || availability > AVAILABILITY_ALWAYS)
1696 return;
1697
1698 if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
1699 return;
1700
1701 if (!(level & ALL_GUILDFINDER_LEVELS) || level > ALL_GUILDFINDER_LEVELS)
1702 return;
1703
1704 Player* player = _player;
1705 if (!player->getGuildId())
1706 return;
1707
1708 if (Guild* guild = sGuildMgr.getGuildById(player->getGuildId()))
1709 {
1710 if (guild->getLeaderGUID() != player->getGuid())
1711 return;
1712 }
1713
1714 LFGuildSettings settings(listed, player->getTeam(), player->getGuildId(), static_cast<uint8_t>(classRoles), static_cast<uint8_t>(availability), static_cast<uint8_t>(guildInterests), static_cast<uint8_t>(level), comment);
1715 sGuildFinderMgr.setGuildSettings(player->getGuildId(), settings);
1716#endif
1717}
@ ALL_GUILDFINDER_LEVELS
std::size_t length(const utf8_string &string)
Definition utf8.cpp:13
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildInfo()

void WorldSession::handleGuildInfo ( WorldPacket )
private

Definition at line 103 of file GuildHandler.cpp.

104{
105#if VERSION_STRING < Cata
106 if (const auto guild = _player->getGuild())
107 SendPacket(SmsgGuildInfo(guild->getName(), guild->getCreatedDate(), guild->getMembersCount(), guild->getAccountCount()).serialise().get());
108#endif
109}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildLeader()

void WorldSession::handleGuildLeader ( WorldPacket recvPacket)
private

Definition at line 212 of file GuildHandler.cpp.

213{
214 CmsgGuildLeader srlPacket;
215 if (!srlPacket.deserialise(recvPacket))
216 return;
217
218 const auto targetPlayerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.name);
219 if (targetPlayerInfo == nullptr)
220 {
222 return;
223 }
224
225 if (Guild* guild = _player->getGuild())
226 guild->handleSetNewGuildMaster(this, targetPlayerInfo->name);
227}
@ GC_TYPE_CREATE
@ GC_ERROR_PLAYER_NOT_FOUND_S
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildLeave()

void WorldSession::handleGuildLeave ( WorldPacket )
private

Definition at line 158 of file GuildHandler.cpp.

159{
160 if (Guild* guild = _player->getGuild())
161 guild->handleLeaveMember(this);
162}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildLog()

void WorldSession::handleGuildLog ( WorldPacket )
private

Definition at line 170 of file GuildHandler.cpp.

171{
172 if (Guild* guild = _player->getGuild())
173 guild->sendEventLog(this);
174}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildMotd()

void WorldSession::handleGuildMotd ( WorldPacket recvPacket)
private

Definition at line 229 of file GuildHandler.cpp.

230{
231 CmsgGuildMotd srlPacket;
232 if (!srlPacket.deserialise(recvPacket))
233 return;
234
235 if (Guild* guild = _player->getGuild())
236 guild->handleSetMOTD(this, srlPacket.message);
237}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildNewsUpdateStickyOpcode()

void WorldSession::handleGuildNewsUpdateStickyOpcode ( WorldPacket recvPacket)
private

Definition at line 1205 of file GuildHandler.cpp.

1206{
1207#if VERSION_STRING >= Cata
1208 uint32_t newsId;
1209 recvPacket >> newsId;
1210
1211 ObjectGuid guid;
1212 guid[2] = recvPacket.readBit();
1213 guid[4] = recvPacket.readBit();
1214 guid[3] = recvPacket.readBit();
1215 guid[0] = recvPacket.readBit();
1216
1217 bool isSticky = recvPacket.readBit();
1218
1219 guid[6] = recvPacket.readBit();
1220 guid[7] = recvPacket.readBit();
1221 guid[1] = recvPacket.readBit();
1222 guid[5] = recvPacket.readBit();
1223
1224 recvPacket.ReadByteSeq(guid[6]);
1225 recvPacket.ReadByteSeq(guid[2]);
1226 recvPacket.ReadByteSeq(guid[1]);
1227 recvPacket.ReadByteSeq(guid[0]);
1228 recvPacket.ReadByteSeq(guid[5]);
1229 recvPacket.ReadByteSeq(guid[3]);
1230 recvPacket.ReadByteSeq(guid[7]);
1231 recvPacket.ReadByteSeq(guid[4]);
1232
1233 if (Guild* guild = _player->getGuild())
1234 guild->handleNewsSetSticky(this, newsId, isSticky);
1235#endif
1236}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildPermissions()

void WorldSession::handleGuildPermissions ( WorldPacket )
private

Definition at line 176 of file GuildHandler.cpp.

177{
178 if (Guild* guild = _player->getGuild())
179 guild->sendPermissions(this);
180}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildPromote()

void WorldSession::handleGuildPromote ( WorldPacket recvPacket)
private

Definition at line 279 of file GuildHandler.cpp.

280{
281 CmsgGuildPromote srlPacket;
282 if (!srlPacket.deserialise(recvPacket))
283 return;
284
285#if VERSION_STRING < Cata
286 const auto targetPlayerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.name);
287 if (targetPlayerInfo == nullptr)
288 return;
289
290 if (Guild* guild = _player->getGuild())
291 guild->handleUpdateMemberRank(this, targetPlayerInfo->guid, false);
292#else
293 if (Guild* guild = _player->getGuild())
294 guild->handleUpdateMemberRank(this, srlPacket.guid, false);
295
296#endif
297}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildQuery()

void WorldSession::handleGuildQuery ( WorldPacket recvPacket)
private

Definition at line 74 of file GuildHandler.cpp.

75{
76 CmsgGuildQuery srlPacket;
77 if (!srlPacket.deserialise(recvPacket))
78 return;
79
80 const auto guild = sGuildMgr.getGuildById(uint32_t(srlPacket.guildId));
81 if (guild == nullptr)
82 return;
83
84#if VERSION_STRING < Cata
85 guild->handleQuery(this);
86#else
87
88 if (guild->isMember(srlPacket.playerGuid))
89 guild->handleQuery(this);
90#endif
91}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildQueryNewsOpcode()

void WorldSession::handleGuildQueryNewsOpcode ( WorldPacket recvPacket)
private

Definition at line 1195 of file GuildHandler.cpp.

1196{
1197#if VERSION_STRING >= Cata
1198 recvPacket.read_skip<uint32_t>();
1199
1200 if (Guild* guild = _player->getGuild())
1201 guild->sendNewsUpdate(this);
1202#endif
1203}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildQueryRanksOpcode()

void WorldSession::handleGuildQueryRanksOpcode ( WorldPacket recvPacket)
private

Definition at line 1008 of file GuildHandler.cpp.

1009{
1010#if VERSION_STRING >= Cata
1011 ObjectGuid guildGuid;
1012
1013 guildGuid[2] = recvPacket.readBit();
1014 guildGuid[3] = recvPacket.readBit();
1015 guildGuid[0] = recvPacket.readBit();
1016 guildGuid[6] = recvPacket.readBit();
1017 guildGuid[4] = recvPacket.readBit();
1018 guildGuid[7] = recvPacket.readBit();
1019 guildGuid[5] = recvPacket.readBit();
1020 guildGuid[1] = recvPacket.readBit();
1021
1022 recvPacket.ReadByteSeq(guildGuid[3]);
1023 recvPacket.ReadByteSeq(guildGuid[4]);
1024 recvPacket.ReadByteSeq(guildGuid[5]);
1025 recvPacket.ReadByteSeq(guildGuid[7]);
1026 recvPacket.ReadByteSeq(guildGuid[1]);
1027 recvPacket.ReadByteSeq(guildGuid[0]);
1028 recvPacket.ReadByteSeq(guildGuid[6]);
1029 recvPacket.ReadByteSeq(guildGuid[2]);
1030
1031 sLogger.debug("CMSG_GUILD_QUERY_RANKS {}: Guild: {}", _player->getName(), WoWGuid::getGuidLowPartFromUInt64(guildGuid));
1032
1033 if (Guild* guild = sGuildMgr.getGuildById(WoWGuid::getGuidLowPartFromUInt64(guildGuid)))
1034 {
1035 if (guild->isMember(_player->getGuid()))
1036 guild->sendGuildRankInfo(this);
1037 }
1038#endif
1039}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildQueryXPOpcode()

void WorldSession::handleGuildQueryXPOpcode ( WorldPacket recvPacket)
private

Definition at line 1049 of file GuildHandler.cpp.

1050{
1051#if VERSION_STRING >= Cata
1052 ObjectGuid guildGuid;
1053
1054 guildGuid[2] = recvPacket.readBit();
1055 guildGuid[1] = recvPacket.readBit();
1056 guildGuid[0] = recvPacket.readBit();
1057 guildGuid[5] = recvPacket.readBit();
1058 guildGuid[4] = recvPacket.readBit();
1059 guildGuid[7] = recvPacket.readBit();
1060 guildGuid[6] = recvPacket.readBit();
1061 guildGuid[3] = recvPacket.readBit();
1062
1063 recvPacket.ReadByteSeq(guildGuid[7]);
1064 recvPacket.ReadByteSeq(guildGuid[2]);
1065 recvPacket.ReadByteSeq(guildGuid[3]);
1066 recvPacket.ReadByteSeq(guildGuid[6]);
1067 recvPacket.ReadByteSeq(guildGuid[1]);
1068 recvPacket.ReadByteSeq(guildGuid[5]);
1069 recvPacket.ReadByteSeq(guildGuid[0]);
1070 recvPacket.ReadByteSeq(guildGuid[4]);
1071
1072 uint32_t guildId = WoWGuid::getGuidLowPartFromUInt64(guildGuid);
1073
1074 sLogger.debug("CMSG_QUERY_GUILD_XP {}: guildId: {}", _player->getName(), guildId);
1075
1076 if (Guild* guild = sGuildMgr.getGuildById(guildId))
1077 {
1078 if (guild->isMember(_player->getGuid()))
1079 guild->sendGuildXP(this);
1080 }
1081#endif
1082}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildRemove()

void WorldSession::handleGuildRemove ( WorldPacket recvPacket)
private

Definition at line 259 of file GuildHandler.cpp.

260{
261 CmsgGuildRemove srlPacket;
262 if (!srlPacket.deserialise(recvPacket))
263 return;
264
265#if VERSION_STRING < Cata
266 const auto targetPlayerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.name);
267 if (targetPlayerInfo == nullptr)
268 return;
269
270 if (Guild* guild = _player->getGuild())
271 guild->handleRemoveMember(this, targetPlayerInfo->guid);
272#else
273 if (Guild* guild = _player->getGuild())
274 guild->handleRemoveMember(this, srlPacket.guid);
275
276#endif
277}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildRequestChallengeUpdate()

void WorldSession::handleGuildRequestChallengeUpdate ( WorldPacket )
private

Definition at line 1041 of file GuildHandler.cpp.

1042{
1043#if VERSION_STRING >= Cata
1044 if (Guild* guild = _player->getGuild())
1045 guild->handleGuildRequestChallengeUpdate(this);
1046#endif
1047}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildRequestMaxDailyXP()

void WorldSession::handleGuildRequestMaxDailyXP ( WorldPacket recvPacket)
private

Definition at line 1114 of file GuildHandler.cpp.

1115{
1116#if VERSION_STRING >= Cata
1117 ObjectGuid guid;
1118
1119 guid[0] = recvPacket.readBit();
1120 guid[3] = recvPacket.readBit();
1121 guid[5] = recvPacket.readBit();
1122 guid[1] = recvPacket.readBit();
1123 guid[4] = recvPacket.readBit();
1124 guid[6] = recvPacket.readBit();
1125 guid[7] = recvPacket.readBit();
1126 guid[2] = recvPacket.readBit();
1127
1128 recvPacket.ReadByteSeq(guid[7]);
1129 recvPacket.ReadByteSeq(guid[4]);
1130 recvPacket.ReadByteSeq(guid[3]);
1131 recvPacket.ReadByteSeq(guid[5]);
1132 recvPacket.ReadByteSeq(guid[1]);
1133 recvPacket.ReadByteSeq(guid[2]);
1134 recvPacket.ReadByteSeq(guid[6]);
1135 recvPacket.ReadByteSeq(guid[0]);
1136
1137 uint32_t guildId = WoWGuid::getGuidLowPartFromUInt64(guid);
1138
1139 if (Guild* guild = sGuildMgr.getGuildById(guildId))
1140 {
1141 if (guild->isMember(_player->getGuid()))
1142 {
1144 data << uint64_t(worldConfig.guild.maxXpPerDay);
1145 SendPacket(&data);
1146 }
1147 }
1148#endif
1149}
@ SMSG_GUILD_MAX_DAILY_XP
Definition Opcodes.hpp:1638
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildRequestPartyState()

void WorldSession::handleGuildRequestPartyState ( WorldPacket recvPacket)
private

Definition at line 1084 of file GuildHandler.cpp.

1085{
1086#if VERSION_STRING >= Cata
1087 ObjectGuid guildGuid;
1088
1089 guildGuid[0] = recvPacket.readBit();
1090 guildGuid[6] = recvPacket.readBit();
1091 guildGuid[7] = recvPacket.readBit();
1092 guildGuid[3] = recvPacket.readBit();
1093 guildGuid[5] = recvPacket.readBit();
1094 guildGuid[1] = recvPacket.readBit();
1095 guildGuid[2] = recvPacket.readBit();
1096 guildGuid[4] = recvPacket.readBit();
1097
1098 recvPacket.ReadByteSeq(guildGuid[6]);
1099 recvPacket.ReadByteSeq(guildGuid[3]);
1100 recvPacket.ReadByteSeq(guildGuid[2]);
1101 recvPacket.ReadByteSeq(guildGuid[1]);
1102 recvPacket.ReadByteSeq(guildGuid[5]);
1103 recvPacket.ReadByteSeq(guildGuid[0]);
1104 recvPacket.ReadByteSeq(guildGuid[7]);
1105 recvPacket.ReadByteSeq(guildGuid[4]);
1106
1107 uint32_t guildId = WoWGuid::getGuidLowPartFromUInt64(guildGuid);
1108
1109 if (Guild* guild = sGuildMgr.getGuildById(guildId))
1110 guild->handleGuildPartyRequest(this);
1111#endif
1112}
Here is the call graph for this function:

◆ handleGuildRewardsQueryOpcode()

void WorldSession::handleGuildRewardsQueryOpcode ( WorldPacket recvPacket)
private

Definition at line 1166 of file GuildHandler.cpp.

1167{
1168#if VERSION_STRING >= Cata
1169 recvPacket.read_skip<uint32_t>();
1170
1171 if (sGuildMgr.getGuildById(_player->getGuildId()))
1172 {
1173 std::vector<GuildReward> const& rewards = sGuildMgr.getGuildRewards();
1174
1175 WorldPacket data(SMSG_GUILD_REWARDS_LIST, 3 + rewards.size() * (4 + 4 + 4 + 8 + 4 + 4));
1176 data.writeBits(rewards.size(), 21);
1177 data.flushBits();
1178
1179 for (uint32_t i = 0; i < rewards.size(); ++i)
1180 {
1181 data << uint32_t(rewards[i].standing);
1182 data << int32_t(rewards[i].racemask);
1183 data << uint32_t(rewards[i].entry);
1184 data << uint64_t(rewards[i].price);
1185 data << uint32_t(0);
1186 data << uint32_t(rewards[i].achievementId);
1187 }
1188 data << uint32_t(time(nullptr));
1189
1190 SendPacket(&data);
1191 }
1192#endif
1193}
@ SMSG_GUILD_REWARDS_LIST
Definition Opcodes.hpp:1654
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildRoster()

void WorldSession::handleGuildRoster ( WorldPacket )
private

Definition at line 150 of file GuildHandler.cpp.

151{
152 if (Guild* guild = _player->getGuild())
153 guild->handleRoster(this);
154 else
156}
@ GC_TYPE_ROSTER
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildSetGuildMaster()

void WorldSession::handleGuildSetGuildMaster ( WorldPacket recvPacket)
private

Definition at line 1238 of file GuildHandler.cpp.

1239{
1240#if VERSION_STRING >= Cata
1241 const auto nameLength = static_cast<uint8_t>(recvPacket.readBits(7));
1242
1243 recvPacket.readBit();
1244
1245 const auto playerName = recvPacket.ReadString(nameLength);
1246
1247 if (Guild* guild = _player->getGuild())
1248 guild->handleSetNewGuildMaster(this, playerName);
1249#endif
1250}
Here is the call graph for this function:

◆ handleGuildSetNoteOpcode()

void WorldSession::handleGuildSetNoteOpcode ( WorldPacket recvPacket)
private

Definition at line 351 of file GuildHandler.cpp.

352{
353#if VERSION_STRING >= Cata
354 CmsgGuildSetNote srlPacket;
355 if (!srlPacket.deserialise(recvPacket))
356 return;
357
358 if (Guild* guild = _player->getGuild())
359 guild->handleSetMemberNote(this, srlPacket.note, srlPacket.guid, srlPacket.isPublic);
360#endif
361}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildSetOfficerNote()

void WorldSession::handleGuildSetOfficerNote ( WorldPacket recvPacket)
private

Definition at line 335 of file GuildHandler.cpp.

336{
337#if VERSION_STRING < Cata
338 CmsgGuildSetOfficerNote srlPacket;
339 if (!srlPacket.deserialise(recvPacket))
340 return;
341
342 const auto targetPlayerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.targetName);
343 if (targetPlayerInfo == nullptr)
344 return;
345
346 if (Guild* guild = _player->getGuild())
347 guild->handleSetMemberNote(this, srlPacket.note, targetPlayerInfo->guid, false);
348#endif
349}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildSetPublicNote()

void WorldSession::handleGuildSetPublicNote ( WorldPacket recvPacket)
private

Definition at line 319 of file GuildHandler.cpp.

320{
321#if VERSION_STRING < Cata
322 CmsgGuildSetPublicNote srlPacket;
323 if (!srlPacket.deserialise(recvPacket))
324 return;
325
326 const auto targetPlayerInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.targetName);
327 if (targetPlayerInfo == nullptr)
328 return;
329
330 if (Guild* guild = _player->getGuild())
331 guild->handleSetMemberNote(this, srlPacket.note, targetPlayerInfo->guid, true);
332#endif
333}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGuildSetRank()

void WorldSession::handleGuildSetRank ( WorldPacket recvPacket)
private

Definition at line 506 of file GuildHandler.cpp.

507{
508 CmsgGuildSetRank srlPacket;
509 if (!srlPacket.deserialise(recvPacket))
510 return;
511
512 if (Guild* guild = _player->getGuild())
513 guild->handleSetRankInfo(this, static_cast<uint8_t>(srlPacket.newRankId), srlPacket.rankName, srlPacket.newRights, srlPacket.moneyPerDay, srlPacket._rightsAndSlots);
514}
GuildBankRightsAndSlotsVec _rightsAndSlots
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleIgnoreTrade()

void WorldSession::handleIgnoreTrade ( WorldPacket )
protected

Definition at line 583 of file TradeHandler.cpp.

584{
585#if VERSION_STRING < Cata
586 const auto tradeData = _player->getTradeData();
587 if (tradeData == nullptr)
588 {
590 return;
591 }
592
594 tradeData->getTradeTarget()->getSession()->sendTradeResult(TRADE_STATUS_IGNORES_YOU);
595
596 // Client sends this opcode after trade is created so TradeData must be cleaned
597 _player->cancelTrade(false, true);
598#endif
599}
@ TRADE_STATUS_IGNORES_YOU
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleInitiateTradeOpcode()

void WorldSession::handleInitiateTradeOpcode ( WorldPacket recvPacket)
protected

Definition at line 27 of file TradeHandler.cpp.

28{
29#if VERSION_STRING < Cata
30 CmsgInitiateTrade srlPacket;
31 if (!srlPacket.deserialise(recvPacket))
32 return;
33
34 const auto playerTarget = _player->getWorldMapPlayer(srlPacket.guid.getGuidLow());
35#else
36 ObjectGuid targetGuid;
37
38 targetGuid[0] = recvPacket.readBit();
39 targetGuid[3] = recvPacket.readBit();
40 targetGuid[5] = recvPacket.readBit();
41 targetGuid[1] = recvPacket.readBit();
42 targetGuid[4] = recvPacket.readBit();
43 targetGuid[6] = recvPacket.readBit();
44 targetGuid[7] = recvPacket.readBit();
45 targetGuid[2] = recvPacket.readBit();
46
47 recvPacket.ReadByteSeq(targetGuid[7]);
48 recvPacket.ReadByteSeq(targetGuid[4]);
49 recvPacket.ReadByteSeq(targetGuid[3]);
50 recvPacket.ReadByteSeq(targetGuid[5]);
51 recvPacket.ReadByteSeq(targetGuid[1]);
52 recvPacket.ReadByteSeq(targetGuid[2]);
53 recvPacket.ReadByteSeq(targetGuid[6]);
54 recvPacket.ReadByteSeq(targetGuid[0]);
55
56 const auto playerTarget = _player->getWorldMapPlayer(static_cast<uint32_t>(targetGuid));
57#endif
58
59 if (_player->m_TradeData != nullptr)
60 {
62 return;
63 }
64
65 if (playerTarget == nullptr || playerTarget == _player)
66 {
68 return;
69 }
70
71 if (playerTarget->CalcDistance(_player) > 10.0f)
72 {
74 return;
75 }
76
77 if (playerTarget->m_TradeData != nullptr)
78 {
80 return;
81 }
82
84 {
86 return;
87 }
88
89 if (playerTarget->hasUnitStateFlag(UNIT_STATE_STUNNED))
90 {
92 return;
93 }
94
95 if (!_player->isAlive())
96 {
98 return;
99 }
100
101 if (!playerTarget->isAlive())
102 {
104 return;
105 }
106
107 if (LoggingOut)
108 {
110 return;
111 }
112
113 if (playerTarget->getSession()->LoggingOut)
114 {
116 return;
117 }
118
119 if (playerTarget->getTeam() != _player->getTeam() && !hasPermissions() && !worldConfig.player.isInterfactionTradeEnabled)
120 {
122 return;
123 }
124
125 _player->m_TradeData = std::make_unique<TradeData>(_player, playerTarget);
126 playerTarget->m_TradeData = std::make_unique<TradeData>(playerTarget, _player);
127
128#if VERSION_STRING < Cata
129 playerTarget->m_session->sendTradeResult(TRADE_STATUS_PROPOSED, _player->getGuid());
130#else
132 data.writeBit(false);
133 data.writeBits(TRADE_STATUS_PROPOSED, 5);
134
135 ObjectGuid source_guid = _player->getGuid();
136 data.WriteByteMask(source_guid[2]);
137 data.WriteByteMask(source_guid[4]);
138 data.WriteByteMask(source_guid[6]);
139 data.WriteByteMask(source_guid[0]);
140 data.WriteByteMask(source_guid[1]);
141 data.WriteByteMask(source_guid[3]);
142 data.WriteByteMask(source_guid[7]);
143 data.WriteByteMask(source_guid[5]);
144
145 data.WriteByteSeq(source_guid[4]);
146 data.WriteByteSeq(source_guid[1]);
147 data.WriteByteSeq(source_guid[2]);
148 data.WriteByteSeq(source_guid[3]);
149 data.WriteByteSeq(source_guid[0]);
150 data.WriteByteSeq(source_guid[7]);
151 data.WriteByteSeq(source_guid[6]);
152 data.WriteByteSeq(source_guid[5]);
153
154 data << uint32_t(0); // unk
155
156 playerTarget->getSession()->SendPacket(&data);
157#endif
158}
@ SMSG_TRADE_STATUS
Definition Opcodes.hpp:332
@ TRADE_STATUS_YOU_STUNNED
@ TRADE_STATUS_YOU_DEAD
@ TRADE_STATUS_PROPOSED
@ TRADE_STATUS_YOU_LOGOUT
@ TRADE_STATUS_TARGET_DEAD
@ TRADE_STATUS_ALREADY_TRADING
@ TRADE_STATUS_TARGET_LOGOUT
@ TRADE_STATUS_TARGET_STUNNED
@ TRADE_STATUS_WRONG_FACTION
@ UNIT_STATE_STUNNED
Player * getWorldMapPlayer(const uint64_t &guid) const
Definition Object.cpp:4586
bool hasUnitStateFlag(uint32_t state_flag) const
Definition Unit.hpp:717
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleInrangeQuestgiverQuery()

void WorldSession::handleInrangeQuestgiverQuery ( WorldPacket )
protected

Definition at line 116 of file QueryHandler.cpp.

117{
118 std::vector<QuestgiverInrangeStatus> questgiverSet;
120
121 for (const auto& inrangeObject : _player->getInRangeObjectsSet())
122 {
123 if (inrangeObject == nullptr || !inrangeObject->isCreature())
124 continue;
125
126 if (const auto creature = dynamic_cast<Creature*>(inrangeObject))
127 {
128 if (creature->isQuestGiver())
129 {
130 temp.rawGuid = creature->getGuid();
131#if VERSION_STRING < Cata
132 temp.status = static_cast<uint8_t>(sQuestMgr.CalcStatus(creature, _player));
133#else
134 temp.status = sQuestMgr.CalcStatus(creature, _player);
135#endif
136 questgiverSet.push_back(temp);
137 }
138 }
139 }
140
141 SendPacket(SmsgQuestgiverStatusMultiple(uint32_t(questgiverSet.size()), questgiverSet).serialise().get());
142}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleInsertGemOpcode()

void WorldSession::handleInsertGemOpcode ( WorldPacket recvPacket)
protected

Definition at line 2744 of file ItemHandler.cpp.

2745{
2746#if VERSION_STRING > Classic
2747 CmsgSocketGems srlPacket;
2748 if (!srlPacket.deserialise(recvPacket))
2749 return;
2750
2752 Item* TargetItem = itemi->GetItemByGUID(srlPacket.itemGuid);
2753 if (!TargetItem)
2754 return;
2755
2756 ItemProperties const* TargetProto = TargetItem->getItemProperties();
2757 int slot = itemi->GetInventorySlotByGuid(srlPacket.itemGuid);
2758
2759 bool apply = slot >= 0 && slot < 19;
2760 uint32_t FilledSlots = 0;
2761
2762 //cheat -> tried to socket same gem multiple times
2763 if (srlPacket.gemGuid[0]
2764 && (srlPacket.gemGuid[0] == srlPacket.gemGuid[1] || srlPacket.gemGuid[0] == srlPacket.gemGuid[2])
2765 || srlPacket.gemGuid[1] && srlPacket.gemGuid[1] == srlPacket.gemGuid[2])
2766 {
2767 return;
2768 }
2769
2770 bool ColorMatch = true;
2771 WDB::Structures::GemPropertiesEntry const* gem_properties;
2772 WDB::Structures::SpellItemEnchantmentEntry const* spell_item_enchant;
2773
2774 for (uint8_t i = 0; i < TargetItem->getSocketSlotCount(); ++i)
2775 {
2776 const auto enchantmentSlot = static_cast<EnchantmentSlot>(SOCK_ENCHANTMENT_SLOT1 + i);
2777 EnchantmentInstance* EI = TargetItem->getEnchantment(enchantmentSlot);
2778
2779 if (EI)
2780 {
2781 // Do not count enchanting/blacksmithing prismatic sockets towards socket bonus
2782 if (TargetProto->Sockets[i].SocketColor)
2783 FilledSlots++;
2784
2785 ItemProperties const* ip = sMySQLStore.getItemProperties(EI->Enchantment->GemEntry);
2786 if (ip == nullptr)
2787 gem_properties = nullptr;
2788 else
2789 gem_properties = sGemPropertiesStore.lookupEntry(ip->GemProperties);
2790
2791 // Skip checks for enchanting/blacksmithing prismatic socket slots
2792 // Also skip check if this gem is about to be replaced
2793 if (gem_properties && TargetProto->Sockets[i].SocketColor && !srlPacket.gemGuid[i] &&
2794 !(gem_properties->SocketMask & TargetProto->Sockets[i].SocketColor))
2795 {
2796 ColorMatch = false;
2797 }
2798 }
2799
2800 if (srlPacket.gemGuid[i]) //add or replace gem
2801 {
2802 Item* it = nullptr;
2803 ItemProperties const* ip = nullptr;
2804
2805 // Check if item has socket slot in this slot
2806 if (!TargetProto->Sockets[i].SocketColor)
2807 {
2808#if VERSION_STRING < WotLK
2809 // Tried to add gem to a slot that does not exist in item
2810 return;
2811#else
2812 // Check for prismatic slot enchantment
2814 return;
2815
2816 // not first not-colored (not normally used) socket
2817 if (i != 0 && !TargetProto->Sockets[i - 1].SocketColor && (i + 1 >= 3
2818 || TargetProto->Sockets[i + 1].SocketColor))
2819 return;
2820
2821 // ok, this is first not colored socket for item with prismatic socket
2822#endif
2823 }
2824
2825 if (apply)
2826 {
2827 it = itemi->GetItemByGUID(srlPacket.gemGuid[i]);
2828 if (!it)
2829 continue;
2830
2831 ip = it->getItemProperties();
2832 if (ip->Flags & ITEM_FLAG_UNIQUE_EQUIP && itemi->IsEquipped(ip->ItemId))
2833 {
2835 continue;
2836 }
2837
2838 // Skill requirement
2839 if (ip->RequiredSkill)
2840 {
2842 {
2844 continue;
2845 }
2846 }
2847#if VERSION_STRING > TBC
2848 if (ip->ItemLimitCategory)
2849 {
2850 auto item_limit_category = sItemLimitCategoryStore.lookupEntry(ip->ItemLimitCategory);
2851 if (item_limit_category != nullptr
2852 && itemi->GetEquippedCountByItemLimit(ip->ItemLimitCategory) >= item_limit_category->maxAmount)
2853 {
2855 continue;
2856 }
2857 }
2858#endif
2859 }
2860
2861 auto itemHolder = itemi->SafeRemoveAndRetreiveItemByGuid(srlPacket.gemGuid[i], true);
2862 if (!itemHolder)
2863 return; //someone sending hacked packets to crash server
2864
2865 gem_properties = sGemPropertiesStore.lookupEntry(itemHolder->getItemProperties()->GemProperties);
2866 itemHolder = nullptr;
2867
2868 if (!gem_properties)
2869 continue;
2870
2871 // Skip checks for enchanting/blacksmithing prismatic socket slots
2872 if (TargetProto->Sockets[i].SocketColor && !(gem_properties->SocketMask & TargetProto->Sockets[i].SocketColor))
2873 ColorMatch = false;
2874
2875 //this is ok in few cases
2876 if (!gem_properties->EnchantmentID)
2877 continue;
2878
2879 //Meta gems only go in meta sockets.
2880 if (TargetProto->Sockets[i].SocketColor != GEM_META_SOCKET && gem_properties->SocketMask == GEM_META_SOCKET)
2881 continue;
2882
2883 //replace gem
2884 if (EI)
2885 {
2886 // Remove previous gem
2887 TargetItem->removeEnchantment(enchantmentSlot);
2888 }
2889 else
2890 {
2891 // Do not count enchanting/blacksmithing prismatic sockets towards socket bonus
2892 if (TargetProto->Sockets[i].SocketColor)
2893 FilledSlots++;
2894 }
2895
2896 spell_item_enchant = sSpellItemEnchantmentStore.lookupEntry(gem_properties->EnchantmentID);
2897 if (spell_item_enchant != nullptr)
2898 TargetItem->addEnchantment(gem_properties->EnchantmentID, enchantmentSlot, 0);
2899 }
2900 }
2901
2902 //Add color match bonus
2903 if (TargetItem->getItemProperties()->SocketBonus)
2904 {
2905 if (ColorMatch && FilledSlots >= TargetItem->getSocketSlotCount(false))
2906 {
2907 if (TargetItem->hasEnchantment(TargetItem->getItemProperties()->SocketBonus))
2908 return;
2909
2910 spell_item_enchant = sSpellItemEnchantmentStore.lookupEntry(TargetItem->getItemProperties()->SocketBonus);
2911 if (spell_item_enchant != nullptr)
2913 }
2914 else //remove
2915 {
2916 TargetItem->removeSocketBonusEnchant();
2917 }
2918 }
2919
2920 TargetItem->m_isDirty = true;
2921#endif
2922}
@ ITEM_FLAG_UNIQUE_EQUIP
@ GEM_META_SOCKET
@ INV_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED
@ INV_ERR_SKILL_ISNT_HIGH_ENOUGH
EnchantmentSlot
@ PRISMATIC_ENCHANTMENT_SLOT
@ BONUS_ENCHANTMENT_SLOT
@ SOCK_ENCHANTMENT_SLOT1
SERVER_DECL WDB::WDBContainer< WDB::Structures::GemPropertiesEntry > sGemPropertiesStore
SERVER_DECL WDB::WDBContainer< WDB::Structures::ItemLimitCategoryEntry > sItemLimitCategoryStore
uint32_t GetEquippedCountByItemLimit(uint32_t LimitId)
bool IsEquipped(uint32_t itemid)
void removeEnchantment(EnchantmentSlot slot, bool timerExpired=false)
Definition Item.cpp:362
bool addEnchantment(uint32_t enchantmentId, EnchantmentSlot slot, uint32_t duration, bool removedAtLogout=false, uint32_t randomSuffix=0)
Definition Item.cpp:286
bool hasEnchantment(uint32_t enchantmentId) const
Definition Item.cpp:264
void removeSocketBonusEnchant()
Definition Item.cpp:419
uint8_t getSocketSlotCount(bool includePrismatic=true) const
Definition Item.cpp:824
EnchantmentInstance * getEnchantment(EnchantmentSlot slot)
Definition Item.cpp:252
void apply(T *val)
WDB::Structures::SpellItemEnchantmentEntry const * Enchantment
Definition Item.hpp:29
uint32_t ItemLimitCategory
SocketInfo Sockets[MAX_ITEM_PROTO_SOCKETS]
uint32_t RequiredSkillRank
uint32_t SocketColor
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleInspectArenaStatsOpcode()

void WorldSession::handleInspectArenaStatsOpcode ( WorldPacket recvPacket)
protected

Definition at line 339 of file ArenaTeamHandler.cpp.

340{
341#if VERSION_STRING != Classic
342 MsgInspectArenaTeams srlPacket;
343 if (!srlPacket.deserialise(recvPacket))
344 return;
345
346 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_INSPECT_ARENA_STATS: {} (guidLow)", srlPacket.guid.getGuidLow());
347
348 const auto player = _player->getWorldMap()->getPlayer(srlPacket.guid.getGuidLow());
349 if (player == nullptr)
350 return;
351
352 std::vector<ArenaTeamsList> arenaTeamList;
353 ArenaTeamsList tempList{};
354
355 for (uint8_t offset = 0; offset < NUM_ARENA_TEAM_TYPES; ++offset)
356 {
357 const uint32_t teamId = player->getArenaTeamId(offset);
358 if (teamId > 0)
359 {
360 const auto arenaTeam = sObjectMgr.getArenaTeamById(teamId);
361 if (arenaTeam != nullptr)
362 {
363 tempList.playerGuid = player->getGuid();
364 tempList.teamType = arenaTeam->m_type;
365 tempList.teamId = arenaTeam->m_id;
366 tempList.teamRating = arenaTeam->m_stats.rating;
367 tempList.playedWeek = arenaTeam->m_stats.played_week;
368 tempList.wonWeek = arenaTeam->m_stats.won_week;
369 tempList.playedSeason = arenaTeam->m_stats.played_season;
370
371 arenaTeamList.push_back(tempList);
372 }
373 }
374 }
375
376 if (!arenaTeamList.empty())
377 SendPacket(MsgInspectArenaTeams(0, arenaTeamList).serialise().get());
378#endif
379}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleInspectHonorStatsOpcode()

void WorldSession::handleInspectHonorStatsOpcode ( WorldPacket recvPacket)
protected

Definition at line 42 of file BattlegroundHandler.cpp.

43{
44 MsgInspectHonorStats srlPacket;
45 if (!srlPacket.deserialise(recvPacket))
46 return;
47
48 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_INSPECT_HONOR_STATS: {} (guidLow)", srlPacket.guid.getGuidLow());
49
50 const auto player = _player->getWorldMap()->getPlayer(srlPacket.guid.getGuidLow());
51 if (player == nullptr)
52 return;
53
54 uint8_t honorCurrency = 0;
55
56#if VERSION_STRING > Classic
57#if VERSION_STRING < Cata
58 honorCurrency = static_cast<uint8_t>(player->getHonorCurrency());
59#endif
60#endif
61
62 const uint32_t lifetimeKills = player->getLifetimeHonorableKills();
63
64 uint32_t kills = 0;
65 uint32_t todayContrib = 0;
66 uint32_t yesterdayContrib = 0;
67
68#if VERSION_STRING != Classic
69 kills = player->getFieldKills();
70#if VERSION_STRING < Cata
71 todayContrib = player->getContributionToday();
72 yesterdayContrib = player->getContributionYesterday();
73#endif
74#endif
75
76 SendPacket(MsgInspectHonorStats(player->getGuid(), honorCurrency, kills, todayContrib, yesterdayContrib, lifetimeKills).serialise().get());
77}
uint32_t getLifetimeHonorableKills() const
Definition Player.cpp:1263
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleInspectOpcode()

void WorldSession::handleInspectOpcode ( WorldPacket recvPacket)
protected

Definition at line 1932 of file MiscHandler.cpp.

1933{
1934#if VERSION_STRING < Mop
1935 CmsgInspect srlPacket;
1936 if (!srlPacket.deserialise(recvPacket))
1937 return;
1938
1939 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_INSPECT: {} (player guid)", static_cast<uint32_t>(srlPacket.guid));
1940
1941 auto inspectedPlayer = _player->getWorldMap()->getPlayer(static_cast<uint32_t>(srlPacket.guid));
1942 if (inspectedPlayer == nullptr)
1943 {
1944 sLogger.debug("Error received CMSG_INSPECT for unknown player!");
1945 return;
1946 }
1947
1948 _player->setTargetGuid(srlPacket.guid);
1949
1952
1953 ByteBuffer packedGuid;
1954 WorldPacket data(SMSG_INSPECT_TALENT, 1000);
1955 packedGuid.appendPackGUID(inspectedPlayer->getGuid());
1956 data.append(packedGuid);
1957
1958 data << uint32_t(inspectedPlayer->getActiveSpec().getTalentPoints());
1959 data << uint8_t(inspectedPlayer->m_talentSpecsCount);
1960 data << uint8_t(inspectedPlayer->m_talentActiveSpec);
1961 for (uint8_t s = 0; s < inspectedPlayer->m_talentSpecsCount; ++s)
1962 {
1963#ifdef FT_DUAL_SPEC
1964 const PlayerSpec playerSpec = inspectedPlayer->m_specs[s];
1965#else
1966 const PlayerSpec playerSpec = inspectedPlayer->m_spec;
1967#endif
1968
1969 uint8_t talentCount = 0;
1970 const auto talentCountPos = data.wpos();
1971 data << uint8_t(talentCount);
1972
1973 const auto talentTabIds = getTalentTabPages(inspectedPlayer->getClass());
1974 for (uint8_t i = 0; i < 3; ++i)
1975 {
1976 const uint32_t talentTabId = talentTabIds[i];
1977 for (uint32_t j = 0; j < sTalentStore.getNumRows(); ++j)
1978 {
1979 const auto talentInfo = sTalentStore.lookupEntry(j);
1980 if (talentInfo == nullptr)
1981 continue;
1982
1983 if (talentInfo->TalentTree != talentTabId)
1984 continue;
1985
1986 int32_t talentMaxRank = -1;
1987 for (int32_t k = 4; k > -1; --k)
1988 {
1989 if (talentInfo->RankID[k] != 0 && inspectedPlayer->hasSpell(talentInfo->RankID[k]))
1990 {
1991 talentMaxRank = k;
1992 break;
1993 }
1994 }
1995
1996 if (talentMaxRank < 0)
1997 continue;
1998
1999 data << uint32_t(talentInfo->TalentID);
2000 data << uint8_t(talentMaxRank);
2001
2002 ++talentCount;
2003 }
2004 }
2005 data.put<uint8_t>(talentCountPos, talentCount);
2006
2007#ifdef FT_GLYPHS
2008 data << uint8_t(GLYPHS_COUNT);
2009
2010 for (const auto& glyph : playerSpec.getGlyphs())
2011 data << uint16_t(glyph);
2012#endif
2013 }
2014
2015 uint32_t slotMask = 0;
2016 const auto slotMaskPos = data.wpos();
2017 data << uint32_t(slotMask);
2018
2019 auto itemInterface = inspectedPlayer->getItemInterface();
2020 for (uint32_t i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
2021 {
2022 const auto inventoryItem = itemInterface->GetInventoryItem(static_cast<uint16_t>(i));
2023 if (!inventoryItem)
2024 continue;
2025
2026 slotMask |= (1 << i);
2027
2028 data << uint32_t(inventoryItem->getEntry());
2029
2030 uint16_t enchantMask = 0;
2031 const auto enchantMaskPos = data.wpos();
2032
2033 data << uint16_t(enchantMask);
2034
2035 for (uint8_t slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
2036 {
2037 const uint32_t enchantId = inventoryItem->getEnchantmentId(slot);
2038 if (!enchantId)
2039 continue;
2040
2041 enchantMask |= (1 << slot);
2042 data << uint16_t(enchantId);
2043 }
2044 data.put<uint16_t>(enchantMaskPos, enchantMask);
2045
2046 data << uint16_t(0);
2047 FastGUIDPack(data, inventoryItem->getCreatorGuid());
2048 data << uint32_t(0);
2049 }
2050 data.put<uint32_t>(slotMaskPos, slotMask);
2051
2052#if VERSION_STRING >= Cata
2053 if (Guild* guild = sGuildMgr.getGuildById(inspectedPlayer->getGuildId()))
2054 {
2055 data << guild->getGUID();
2056 data << uint32_t(guild->getLevel());
2057 data << uint64_t(guild->getExperience());
2058 data << uint32_t(guild->getMembersCount());
2059 }
2060#endif
2061
2062 SendPacket(&data);
2063#endif
2064}
@ MAX_ENCHANTMENT_SLOT
@ SMSG_INSPECT_TALENT
Definition Opcodes.hpp:1095
#define GLYPHS_COUNT
uint32_t const * getTalentTabPages(uint8_t playerClass)
SERVER_DECL WDB::WDBContainer< WDB::Structures::TalentEntry > sTalentStore
static void FastGUIDPack(ByteBuffer &buf, const uint64_t &oldguid)
void appendPackGUID(uint64_t guid)
Definition ByteBuffer.h:562
int8_t m_comboPoints
Definition Player.hpp:985
void updateComboPoints()
Definition Player.cpp:5387
void setTargetGuid(uint64_t guid)
Definition Unit.cpp:401
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleInstanceLockResponse()

void WorldSession::handleInstanceLockResponse ( WorldPacket recvPacket)
protected

Definition at line 2541 of file MiscHandler.cpp.

2542{
2543 uint8_t accept;
2544 recvPacket >> accept;
2545
2546 if (!_player->hasPendingBind())
2547 return;
2548
2549 if (accept)
2551 else
2553
2554 _player->setPendingBind(0, 0);
2555}
const float & GetPositionX() const
Definition Object.hpp:354
const float & GetPositionZ() const
Definition Object.hpp:356
const float & GetPositionY() const
Definition Object.hpp:355
void repopAtGraveyard(float ox, float oy, float oz, uint32_t mapId)
Definition Player.cpp:7622
InstancePlayerBind * bindToInstance(InstanceSaved *save, bool permanent, BindExtensionState extendState=EXTEND_STATE_NORMAL, bool load=false)
Definition Player.cpp:12855
void setPendingBind(uint32_t instanceId, uint32_t bindTimer)
Definition Player.cpp:12921
bool hasPendingBind() const
Definition Player.hpp:2138
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleInviteToGuild()

void WorldSession::handleInviteToGuild ( WorldPacket recvPacket)
private

Definition at line 93 of file GuildHandler.cpp.

94{
95 CmsgGuildInvite srlPacket;
96 if (!srlPacket.deserialise(recvPacket))
97 return;
98
99 if (Guild* guild = _player->getGuild())
100 guild->sendGuildInvitePacket(_player->getSession(), srlPacket.name);
101}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleItemNameQueryOpcode()

void WorldSession::handleItemNameQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 168 of file QueryHandler.cpp.

169{
170 CmsgItemNameQuery srlPacket;
171 if (!srlPacket.deserialise(recvPacket))
172 return;
173
174 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_ITEM_NAME_QUERY: {} (itemEntry)", srlPacket.itemEntry);
175
176 const auto itemProperties = sMySQLStore.getItemProperties(srlPacket.itemEntry);
177 if (itemProperties == nullptr)
178 return;
179
180 const auto localizedItem = language > 0 ? sMySQLStore.getLocalizedItem(srlPacket.itemEntry, language) : nullptr;
181 const auto name = localizedItem ? localizedItem->name : itemProperties->Name.c_str();
182
183 SendPacket(SmsgItemNameQueryResponse(srlPacket.itemEntry, name, itemProperties->InventoryType).serialise().get());
184}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleItemQuerySingleOpcode()

void WorldSession::handleItemQuerySingleOpcode ( WorldPacket recvPacket)
protected

Definition at line 1479 of file ItemHandler.cpp.

1480{
1481#if VERSION_STRING == TBC
1482 CmsgItemQuerySingle srlPacket;
1483 if (!srlPacket.deserialise(recvPacket))
1484 return;
1485
1486 ItemProperties const* itemProto = sMySQLStore.getItemProperties(srlPacket.item_id);
1487 if (!itemProto)
1488 {
1489 sLogger.failure("Unknown item id {}", srlPacket.item_id);
1490 return;
1491 }
1492
1493 std::string Name;
1494 std::string Description;
1495
1496 MySQLStructure::LocalesItem const* li = (language > 0)
1497 ? sMySQLStore.getLocalizedItem(srlPacket.item_id, language) : nullptr;
1498 if (li != nullptr)
1499 {
1500 Name = li->name;
1501 Description = li->description;
1502 }
1503 else
1504 {
1505 Name = itemProto->Name;
1506 Description = itemProto->Description;
1507 }
1508
1510 data << itemProto->ItemId;
1511 data << itemProto->Class;
1512 data << uint32_t(itemProto->SubClass);
1513 data << itemProto->unknown_bc; // soundOverride
1514 data << Name;
1515 data << uint8_t(0); // name 2?
1516 data << uint8_t(0); // name 3?
1517 data << uint8_t(0); // name 4?
1518 data << itemProto->DisplayInfoID;
1519 data << itemProto->Quality;
1520 data << itemProto->Flags;
1521 //data << itemProto->Flags2;
1522 data << itemProto->BuyPrice;
1523 data << itemProto->SellPrice;
1524 data << itemProto->InventoryType;
1525 data << itemProto->AllowableClass;
1526 data << itemProto->AllowableRace;
1527 data << itemProto->ItemLevel;
1528 data << itemProto->RequiredLevel;
1529 data << uint32_t(itemProto->RequiredSkill);
1530 data << itemProto->RequiredSkillRank;
1531 data << itemProto->RequiredSpell;
1532 data << itemProto->RequiredPlayerRank1;
1533 data << itemProto->RequiredPlayerRank2;
1534 data << itemProto->RequiredFaction;
1535 data << itemProto->RequiredFactionStanding;
1536 data << itemProto->Unique;
1537 data << itemProto->MaxCount;
1538 data << itemProto->ContainerSlots;
1539
1540 // we have 10 * 8 bytes of stat data
1541 auto it = itemProto->generalStatsMap.begin();
1542 for (uint8_t i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
1543 {
1544 if (it != itemProto->generalStatsMap.end())
1545 {
1546 data << it->first;
1547 data << it->second;
1548 ++it;
1549 }
1550 else
1551 {
1552 data << uint32_t(0);
1553 data << int32_t(0);
1554 }
1555 }
1556
1557 for (uint8_t i = 0; i < 2; i++)
1558 {
1559 data << itemProto->Damage[i].Min;
1560 data << itemProto->Damage[i].Max;
1561 data << itemProto->Damage[i].Type;
1562 }
1563
1564 for (uint8_t i = 0; i < 3; i++)
1565 {
1566 data << float(0.0f);
1567 data << float(0.0f);
1568 data << uint32_t(0);
1569 }
1570
1571 data << itemProto->Armor;
1572
1573 data << uint32_t(itemProto->getStat(ITEM_MOD_HOLY_RESISTANCE));
1574 data << uint32_t(itemProto->getStat(ITEM_MOD_FIRE_RESISTANCE));
1575 data << uint32_t(itemProto->getStat(ITEM_MOD_NATURE_RESISTANCE));
1576 data << uint32_t(itemProto->getStat(ITEM_MOD_FROST_RESISTANCE));
1577 data << uint32_t(itemProto->getStat(ITEM_MOD_SHADOW_RESISTANCE));
1578 data << uint32_t(itemProto->getStat(ITEM_MOD_ARCANE_RESISTANCE));
1579
1580 data << itemProto->Delay;
1581 data << itemProto->AmmoType;
1582 data << itemProto->Range;
1583 for (uint8_t i = 0; i < 5; i++)
1584 {
1585 data << itemProto->Spells[i].Id;
1586 data << itemProto->Spells[i].Trigger;
1587 data << itemProto->Spells[i].Charges;
1588 data << itemProto->Spells[i].Cooldown;
1589 data << itemProto->Spells[i].Category;
1590 data << itemProto->Spells[i].CategoryCooldown;
1591 }
1592 data << itemProto->Bonding;
1593
1594 data << Description;
1595
1596 data << itemProto->PageId;
1597 data << itemProto->PageLanguage;
1598 data << itemProto->PageMaterial;
1599 data << itemProto->QuestId;
1600 data << itemProto->LockId;
1601 data << itemProto->LockMaterial;
1602 data << itemProto->SheathID;
1603 data << itemProto->RandomPropId;
1604 data << itemProto->RandomSuffixId;
1605 data << itemProto->Block;
1606
1607 const auto setBonus = sMySQLStore.getItemSetLinkedBonus(itemProto->ItemSet);
1608 if (setBonus == 0)
1609 data << itemProto->ItemSet;
1610 else
1611 data << setBonus;
1612
1613 data << itemProto->MaxDurability;
1614 data << itemProto->ZoneNameID;
1615 data << itemProto->MapID;
1616 data << itemProto->BagFamily;
1617 data << itemProto->TotemCategory;
1618 data << itemProto->Sockets[0].SocketColor;
1619 data << itemProto->Sockets[0].Unk;
1620 data << itemProto->Sockets[1].SocketColor;
1621 data << itemProto->Sockets[1].Unk;
1622 data << itemProto->Sockets[2].SocketColor;
1623 data << itemProto->Sockets[2].Unk;
1624 data << itemProto->SocketBonus;
1625 data << itemProto->GemProperties;
1626 data << itemProto->DisenchantReqSkill;
1627 data << itemProto->ArmorDamageModifier;
1628 data << itemProto->ExistingDuration; // 2.4.2 Item duration in seconds
1629
1630 SendPacket(&data);
1631
1632#else
1633
1634 CmsgItemQuerySingle srlPacket;
1635 if (!srlPacket.deserialise(recvPacket))
1636 return;
1637
1638 auto itemProperties = sMySQLStore.getItemProperties(srlPacket.item_id);
1639 if (!itemProperties)
1640 {
1641 sLogger.failure("Unknown item id {}", srlPacket.item_id);
1642 return;
1643 }
1644
1645 std::string Name;
1646 std::string Description;
1647
1649 ? sMySQLStore.getLocalizedItem(srlPacket.item_id, language) : nullptr;
1650 if (li != nullptr)
1651 {
1652 Name = li->name;
1653 Description = li->description;
1654 }
1655 else
1656 {
1657 Name = itemProperties->Name;
1658 Description = itemProperties->Description;
1659 }
1660
1662 data << itemProperties->ItemId;
1663 data << itemProperties->Class;
1664 data << uint32_t(itemProperties->SubClass);
1665 data << itemProperties->unknown_bc; // soundOverride
1666 data << Name;
1667 data << uint8_t(0); // name 2?
1668 data << uint8_t(0); // name 3?
1669 data << uint8_t(0); // name 4?
1670 data << itemProperties->DisplayInfoID;
1671 data << itemProperties->Quality;
1672 data << itemProperties->Flags;
1673 data << itemProperties->Flags2;
1674 data << itemProperties->BuyPrice;
1675 data << itemProperties->SellPrice;
1676 data << itemProperties->InventoryType;
1677 data << itemProperties->AllowableClass;
1678 data << itemProperties->AllowableRace;
1679 data << itemProperties->ItemLevel;
1680 data << itemProperties->RequiredLevel;
1681 data << uint32_t(itemProperties->RequiredSkill);
1682 data << itemProperties->RequiredSkillRank;
1683 data << itemProperties->RequiredSpell;
1684 data << itemProperties->RequiredPlayerRank1;
1685 data << itemProperties->RequiredPlayerRank2;
1686 data << itemProperties->RequiredFaction;
1687 data << itemProperties->RequiredFactionStanding;
1688 data << itemProperties->Unique;
1689 data << itemProperties->MaxCount;
1690 data << itemProperties->ContainerSlots;
1691
1692 data << uint32_t(itemProperties->generalStatsMap.size());
1693 for (auto const& stat : itemProperties->generalStatsMap)
1694 {
1695 data << stat.first;
1696 data << stat.second;
1697 }
1698
1699 data << itemProperties->ScalingStatsEntry;
1700 data << itemProperties->ScalingStatsFlag;
1701
1702 // originally this went up to 5, now only to 2
1703 for (uint8_t i = 0; i < 2; i++)
1704 {
1705 data << itemProperties->Damage[i].Min;
1706 data << itemProperties->Damage[i].Max;
1707 data << itemProperties->Damage[i].Type;
1708 }
1709 data << itemProperties->Armor;
1710
1711 data << uint32_t(itemProperties->getStat(ITEM_MOD_HOLY_RESISTANCE));
1712 data << uint32_t(itemProperties->getStat(ITEM_MOD_FIRE_RESISTANCE));
1713 data << uint32_t(itemProperties->getStat(ITEM_MOD_NATURE_RESISTANCE));
1714 data << uint32_t(itemProperties->getStat(ITEM_MOD_FROST_RESISTANCE));
1715 data << uint32_t(itemProperties->getStat(ITEM_MOD_SHADOW_RESISTANCE));
1716 data << uint32_t(itemProperties->getStat(ITEM_MOD_ARCANE_RESISTANCE));
1717
1718 data << itemProperties->Delay;
1719 data << itemProperties->AmmoType;
1720 data << itemProperties->Range;
1721 for (uint8_t i = 0; i < 5; i++)
1722 {
1723 data << itemProperties->Spells[i].Id;
1724 data << itemProperties->Spells[i].Trigger;
1725 data << itemProperties->Spells[i].Charges;
1726 data << itemProperties->Spells[i].Cooldown;
1727 data << itemProperties->Spells[i].Category;
1728 data << itemProperties->Spells[i].CategoryCooldown;
1729 }
1730 data << itemProperties->Bonding;
1731
1732 data << Description;
1733
1734 data << itemProperties->PageId;
1735 data << itemProperties->PageLanguage;
1736 data << itemProperties->PageMaterial;
1737 data << itemProperties->QuestId;
1738 data << itemProperties->LockId;
1739 data << itemProperties->LockMaterial;
1740 data << itemProperties->SheathID;
1741 data << itemProperties->RandomPropId;
1742 data << itemProperties->RandomSuffixId;
1743 data << itemProperties->Block;
1744
1745 const auto setBonus = sMySQLStore.getItemSetLinkedBonus(itemProperties->ItemSet);
1746 if (setBonus == 0)
1747 data << itemProperties->ItemSet;
1748 else
1749 data << setBonus;
1750
1751 data << itemProperties->MaxDurability;
1752 data << itemProperties->ZoneNameID;
1753 data << itemProperties->MapID;
1754 data << itemProperties->BagFamily;
1755 data << itemProperties->TotemCategory;
1756 data << itemProperties->Sockets[0].SocketColor;
1757 data << itemProperties->Sockets[0].Unk;
1758 data << itemProperties->Sockets[1].SocketColor;
1759 data << itemProperties->Sockets[1].Unk;
1760 data << itemProperties->Sockets[2].SocketColor;
1761 data << itemProperties->Sockets[2].Unk;
1762 data << itemProperties->SocketBonus;
1763 data << itemProperties->GemProperties;
1764 data << itemProperties->DisenchantReqSkill;
1765 data << itemProperties->ArmorDamageModifier;
1766 data << itemProperties->ExistingDuration; // 2.4.2 Item duration in seconds
1767 data << itemProperties->ItemLimitCategory;
1768 data << itemProperties->HolidayId; // HolidayNames.dbc
1769 SendPacket(&data);
1770#endif
1771}
@ ITEM_MOD_HOLY_RESISTANCE
@ ITEM_MOD_NATURE_RESISTANCE
@ ITEM_MOD_FROST_RESISTANCE
@ ITEM_MOD_SHADOW_RESISTANCE
@ ITEM_MOD_FIRE_RESISTANCE
@ ITEM_MOD_ARCANE_RESISTANCE
#define MAX_ITEM_PROTO_STATS
@ SMSG_ITEM_QUERY_SINGLE_RESPONSE
Definition Opcodes.hpp:124
uint32_t Type
uint32_t RequiredPlayerRank1
uint32_t RequiredFactionStanding
uint32_t RequiredFaction
ItemDamage Damage[MAX_ITEM_PROTO_DAMAGES]
ItemSpell Spells[MAX_ITEM_PROTO_SPELLS]
std::string Description
std::map< uint32_t, int32_t > generalStatsMap
uint32_t AllowableClass
uint32_t ExistingDuration
int32_t getStat(uint32_t type) const
uint32_t RequiredPlayerRank2
uint32_t RandomSuffixId
int32_t DisenchantReqSkill
int32_t CategoryCooldown
int32_t Charges
int32_t Cooldown
uint32_t Category
uint32_t Id
uint32_t Trigger
uint32_t Unk
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleItemRefundInfoOpcode()

void WorldSession::handleItemRefundInfoOpcode ( WorldPacket recvPacket)
protected

Definition at line 769 of file ItemHandler.cpp.

770{
771#if VERSION_STRING >= WotLK
772 CmsgItemrefundinfo srlPacket;
773 if (!srlPacket.deserialise(recvPacket))
774 return;
775
776 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_ITEMREFUNDINFO.");
777
778 this->sendRefundInfo(srlPacket.itemGuid);
779#endif
780}
void sendRefundInfo(uint64_t guid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleItemRefundRequestOpcode()

void WorldSession::handleItemRefundRequestOpcode ( WorldPacket recvPacket)
protected

Definition at line 782 of file ItemHandler.cpp.

783{
784#if VERSION_STRING >= WotLK
785 CmsgItemrefundrequest srlPacket;
786 if (!srlPacket.deserialise(recvPacket))
787 return;
788
789 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_ITEMREFUNDREQUEST.");
790
791 uint32_t error = 1;
792
793 WDB::Structures::ItemExtendedCostEntry const* itemExtendedCostEntry = nullptr;
794 ItemProperties const* itemProperties = nullptr;
795
796 auto item = _player->getItemInterface()->GetItemByGUID(srlPacket.itemGuid);
797
798 if (item != nullptr)
799 {
800 if (item->isEligibleForRefund())
801 {
802 const auto refundEntry = _player->getItemInterface()->LookupRefundable(srlPacket.itemGuid);
803
804 if (refundEntry.first != 0 && refundEntry.second != 0)
805 {
806 uint32_t* played = _player->getPlayedTime();
807 if (played[1] < refundEntry.first + 60 * 60 * 2)
808 itemExtendedCostEntry = sItemExtendedCostStore.lookupEntry(refundEntry.second);
809 }
810
811 if (itemExtendedCostEntry != nullptr)
812 {
813 itemProperties = item->getItemProperties();
814
815 for (uint8_t i = 0; i < 5; ++i)
816 _player->getItemInterface()->AddItemById(itemExtendedCostEntry->item[i], itemExtendedCostEntry->count[i], 0);
817
818 _player->getItemInterface()->AddItemById(43308, itemExtendedCostEntry->honor_points, 0);
819 _player->getItemInterface()->AddItemById(43307, itemExtendedCostEntry->arena_points, 0);
820 _player->modCoinage(itemProperties->BuyPrice);
821
822 _player->getItemInterface()->RemoveItemAmtByGuid(srlPacket.itemGuid, 1);
823
824 _player->getItemInterface()->RemoveRefundable(srlPacket.itemGuid);
825
826 error = 0;
827 }
828 }
829 }
830
832 packet << uint64_t(srlPacket.itemGuid);
833 packet << uint32_t(error);
834
835 if (error == 0)
836 {
837 packet << uint32_t(itemProperties->BuyPrice);
838 packet << uint32_t(itemExtendedCostEntry->honor_points);
839 packet << uint32_t(itemExtendedCostEntry->arena_points);
840
841 for (uint8_t i = 0; i < 5; ++i)
842 {
843 packet << uint32_t(itemExtendedCostEntry->item[i]);
844 packet << uint32_t(itemExtendedCostEntry->count[i]);
845 }
846 }
847
848 SendPacket(&packet);
849
850 sLogger.debug("Sent SMSG_ITEMREFUNDREQUEST.");
851#endif
852}
@ SMSG_ITEMREFUNDREQUEST
Definition Opcodes.hpp:1337
SERVER_DECL WDB::WDBContainer< WDB::Structures::ItemExtendedCostEntry > sItemExtendedCostStore
bool AddItemById(uint32_t itemid, uint32_t count, int32_t randomprop)
void RemoveRefundable(uint64_t GUID)
Removes an entry from the RefundableMap.
std::pair< time_t, uint32_t > LookupRefundable(uint64_t GUID)
Looks up an item in the RefundableMap, and returns the data.
uint32_t * getPlayedTime()
Definition Player.cpp:2883
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleItemTextQueryOpcode()

void WorldSession::handleItemTextQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 164 of file MailHandler.cpp.

165{
166 CmsgItemTextQuery srlPacket;
167 if (!srlPacket.deserialise(recvPacket))
168 return;
169
170#if VERSION_STRING > TBC
171 if (const auto item = _player->getItemInterface()->GetItemByGUID(srlPacket.itemGuid))
172 SendPacket(SmsgItemTextQueryResponse(0, srlPacket.itemGuid, item->getText()).serialise().get());
173 else
174 SendPacket(SmsgItemTextQueryResponse(1, 0, "").serialise().get());
175#else
176 if (auto itemPage = sMySQLStore.getItemPage(srlPacket.itemTextId))
177 SendPacket(SmsgItemTextQueryResponse(0, itemPage->id, itemPage->text).serialise().get());
178 else
179 SendPacket(SmsgItemTextQueryResponse(1, 0, "").serialise().get());
180#endif
181}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLearnMultipleTalentsOpcode()

void WorldSession::handleLearnMultipleTalentsOpcode ( WorldPacket recvPacket)
protected

Definition at line 48 of file SkillHandler.cpp.

49{
50#if VERSION_STRING < Cata
51#if VERSION_STRING > TBC
53 if (!srlPacket.deserialise(recvPacket))
54 return;
55
56 sLogger.debug("Recieved CMSG_LEARN_TALENTS_MULTIPLE");
57
58 for (auto learnTalent : srlPacket.multipleTalents)
59 _player->learnTalent(learnTalent.talentId, learnTalent.talentRank);
60
62#endif
63#endif
64}
void smsg_TalentsInfo(bool SendPetTalents)
Definition Player.cpp:6152
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLearnPreviewTalentsOpcode()

void WorldSession::handleLearnPreviewTalentsOpcode ( WorldPacket recvPacket)
protected

Definition at line 66 of file SkillHandler.cpp.

67{
68#if VERSION_STRING >= Cata
69 int32_t current_tab;
70 uint32_t talent_count;
71 uint32_t talent_id;
72 uint32_t talent_rank;
73 //if currentTab -1 player has already the spec.
74 recvPacket >> current_tab;
75 recvPacket >> talent_count;
76
77 for (uint32_t i = 0; i < talent_count; ++i)
78 {
79 recvPacket >> talent_id;
80 recvPacket >> talent_rank;
81
82 _player->learnTalent(talent_id, talent_rank);
83 }
84
86#endif
87}
void learnTalent(uint32_t talentId, uint32_t talentRank)
Definition Player.cpp:5815
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLearnTalentOpcode()

void WorldSession::handleLearnTalentOpcode ( WorldPacket recvPacket)
protected

Definition at line 26 of file SkillHandler.cpp.

27{
28 CmsgLearnTalent srlPacket;
29 if (!srlPacket.deserialise(recvPacket))
30 return;
31
32 _player->learnTalent(srlPacket.talentId, srlPacket.requestedRank);
34}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLeaveBattlefieldOpcode()

void WorldSession::handleLeaveBattlefieldOpcode ( WorldPacket )
protected

Definition at line 134 of file BattlegroundHandler.cpp.

135{
136 if (_player->m_bg && _player->IsInWorld())
138}
void removePlayer(Player *plr, bool logout)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLeaveVehicle()

void WorldSession::handleLeaveVehicle ( WorldPacket )
protected

Definition at line 235 of file VehicleHandler.cpp.

236{
237#if VERSION_STRING > TBC
238 if (Vehicle* vehicle = GetPlayer()->getVehicle())
239 {
240 if (WDB::Structures::VehicleSeatEntry const* seat = vehicle->getSeatForPassenger(GetPlayer()))
241 {
242 if (seat->canEnterOrExit())
243 GetPlayer()->callExitVehicle();
244 }
245 }
246#endif
247}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgJoinOpcode()

void WorldSession::handleLfgJoinOpcode ( WorldPacket recvPacket)
protected

Definition at line 502 of file LfgHandler.cpp.

503{
504#if VERSION_STRING > TBC
505 sLogger.debug("CMSG_LFG_JOIN");
506
508 && (_player->getGroup()->MemberCount() == 5 || !_player->getGroup()->isLFGGroup()))
509 {
510 sLogger.debug("handleLfgJoinOpcode : Unable to JoinQueue");
511
512 recvPacket.clear();
513 return;
514 }
515
516 uint8_t numDungeons;
517 uint32_t dungeon;
518 uint32_t roles;
519
520 recvPacket >> roles;
521 recvPacket.read<uint16_t>(); // uint8_t (always 0) - uint8_t (always 0)
522 recvPacket >> numDungeons;
523
524 if (!numDungeons)
525 {
526 sLogger.debug("CMSG_LFG_JOIN no dungeons selected. Player {}", _player->getName());
527 recvPacket.clear();
528 return;
529 }
530
531 LfgDungeonSet newDungeons;
532 for (int8_t i = 0; i < numDungeons; ++i)
533 {
534 recvPacket >> dungeon;
535 newDungeons.insert(dungeon & 0x00FFFFFF); // remove the type from the dungeon entry
536 }
537
538 recvPacket.read<uint32_t>(); // for 0..uint8_t (always 3) { uint8_t (always 0) }
539
540 std::string comment;
541 recvPacket >> comment;
542 sLogger.debug("CMSG_LFG_JOIN: {}, roles: {}, Dungeons: {}, Comment: {}", _player->getName(), roles, uint8_t(newDungeons.size()), comment);
543 sLfgMgr.Join(_player, uint8_t(roles), newDungeons, comment);
544#endif
545}
#define sLfgMgr
Definition LFGMgr.hpp:366
std::set< uint32_t > LfgDungeonSet
Definition LFG.hpp:75
void clear()
Definition ByteBuffer.h:70
uint32_t MemberCount(void)
Definition Group.h:212
CachedCharacterInfo * GetLeader(void)
Definition Group.h:205
bool isLFGGroup()
Definition Group.h:286
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgLeaveOpcode()

void WorldSession::handleLfgLeaveOpcode ( WorldPacket recvPacket)
protected

Definition at line 547 of file LfgHandler.cpp.

548{
549#if VERSION_STRING > TBC
550 const auto group = _player->getGroup();
551
552 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_LFG_LEAVE {} in group: {}", _player->getGuid(), group ? 1 : 0);
553
554 // Check cheating - only leader can leave the queue
555 if (!group || group->GetLeader()->guid == _player->getGuid())
556 sLfgMgr.Leave(_player, group);
557#endif
558}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgLockInfoOpcode()

void WorldSession::handleLfgLockInfoOpcode ( WorldPacket recvPacket)
protected

Definition at line 491 of file LfgHandler.cpp.

492{
493#if VERSION_STRING >= Cata
494 const bool requestFromPlayer = recvPacket.readBit();
495
496 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_LFG_LOCK_INFO_REQUEST from {}", requestFromPlayer ? "player" : "group");
497
498 //\todo handle player lock info and group lock info here
499#endif
500}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgPartyLockInfoRequestOpcode()

void WorldSession::handleLfgPartyLockInfoRequestOpcode ( WorldPacket recvPacket)
protected

Definition at line 724 of file LfgHandler.cpp.

725{
726#if VERSION_STRING > TBC
727 uint64_t guid = _player->getGuid();
728
729 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_LFD_PARTY_LOCK_INFO_REQUEST guid {}", guid);
730
731 auto grp = _player->getGroup();
732 if (!grp)
733 return;
734
735 // Get the locked dungeons of the other party members
736 LfgLockPartyMap lockMap;
737 for (auto groupPlayerInfo : grp->GetSubGroup(0)->getGroupMembers())
738 {
739 Player* plrg = sObjectMgr.getPlayer(groupPlayerInfo->guid);
740 if (!plrg)
741 continue;
742
743 uint64_t pguid = plrg->getGuid();
744 if (pguid == guid)
745 continue;
746
747 lockMap[pguid] = sLfgMgr.GetLockedDungeons(pguid);
748 }
749
750 uint32_t size = 0;
751 for (auto lock : lockMap)
752 size += 8 + 4 + uint32_t(lock.second.size()) * (4 + 4);
753
754 sLogger.debug("Sent SMSG_LFG_PARTY_INFO {}", guid);
755
756 WorldPacket data(SMSG_LFG_PARTY_INFO, 1 + size);
757 BuildPartyLockDungeonBlock(data, lockMap);
758 SendPacket(&data);
759#endif
760}
std::map< uint64_t, LfgLockMap > LfgLockPartyMap
Definition LFG.hpp:77
void BuildPartyLockDungeonBlock(WorldPacket &data, const LfgLockPartyMap &lockMap)
@ SMSG_LFG_PARTY_INFO
Definition Opcodes.hpp:1187
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgPlayerLockInfoRequestOpcode()

void WorldSession::handleLfgPlayerLockInfoRequestOpcode ( WorldPacket recvPacket)
protected

Definition at line 629 of file LfgHandler.cpp.

630{
631#if VERSION_STRING > TBC
632 uint64_t guid = _player->getGuid();
633
634 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_LFD_PLAYER_LOCK_INFO_REQUEST {}", guid);
635
636 // Get Random dungeons that can be done at a certain level and expansion
637 // todo FIXME - Should return seasonals (when not disabled)
638 LfgDungeonSet randomDungeons;
639 const uint8_t level = static_cast<uint8_t>(_player->getLevel());
640
641#if VERSION_STRING < Cata
642 uint8_t expansion = static_cast<uint8_t>(_player->getSession()->GetFlags());
643 for (uint32_t i = 0; i < sLFGDungeonStore.getNumRows(); ++i)
644 {
645 WDB::Structures::LFGDungeonEntry const* dungeon = sLFGDungeonStore.lookupEntry(i);
646 if (dungeon && dungeon->type == LFG_TYPE_RANDOM && dungeon->expansion <= expansion && dungeon->minlevel <= level && level <= dungeon->maxlevel)
647 randomDungeons.insert(dungeon->Entry());
648
649 }
650#endif
651
652 // Get player locked Dungeons
653 LfgLockMap lock = sLfgMgr.GetLockedDungeons(guid);
654 const uint32_t rsize = uint32_t(randomDungeons.size());
655 const uint32_t lsize = uint32_t(lock.size());
656
657 sLogger.debug("Received SMSG_LFG_PLAYER_INFO {}", guid);
658 WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4));
659
660 data << uint8_t(randomDungeons.size()); // Random Dungeon count
661 for (auto randomDungeon : randomDungeons)
662 {
663 data << uint32_t(randomDungeon); // Dungeon Entry (id + type)
664 LfgReward const* reward = sLfgMgr.GetRandomDungeonReward(randomDungeon, level);
665 QuestProperties const* qRew = nullptr;
666 uint8_t done = 0;
667 if (reward)
668 {
669 qRew = sMySQLStore.getQuestProperties(reward->reward[0].questId);
670 if (qRew)
671 {
672 done = _player->hasQuestFinished(qRew->id);
673 if (done)
674 qRew = sMySQLStore.getQuestProperties(reward->reward[1].questId);
675 }
676 }
677 if (qRew)
678 {
679 data << uint8_t(done);
680 data << uint32_t(qRew->reward_money);
681 data << uint32_t(qRew->reward_xp);
682 data << uint32_t(reward->reward[done].variableMoney);
683 data << uint32_t(reward->reward[done].variableXP);
684 // todo FIXME Linux: error: cast from ‘const uint32_t* {aka const unsigned int*}’ to ‘uint8_t {aka unsigned char}’ loses precision
685 // can someone check this now ?
686
687 data << uint8_t(qRew->GetRewardItemCount());
688 for (uint8_t i = 0; i < 4; ++i)
689 if (qRew->reward_item[i] != 0)
690 {
691 ItemProperties const* item = sMySQLStore.getItemProperties(qRew->reward_item[i]);
692 data << uint32_t(qRew->reward_item[i]);
693 data << uint32_t(item ? item->DisplayInfoID : 0);
694 data << uint32_t(qRew->reward_itemcount[i]);
695 }
696 }
697 else
698 {
699 data << uint8_t(0);
700 data << uint32_t(0);
701 data << uint32_t(0);
702 data << uint32_t(0);
703 data << uint32_t(0);
704 data << uint8_t(0);
705 }
706 }
707 BuildPlayerLockDungeonBlock(data, lock);
708 SendPacket(&data);
709#endif
710}
@ LFG_TYPE_RANDOM
Definition LFGMgr.hpp:43
std::map< uint32_t, LfgLockStatusType > LfgLockMap
Definition LFG.hpp:76
void BuildPlayerLockDungeonBlock(WorldPacket &data, const LfgLockMap &lockMap)
@ SMSG_LFG_PLAYER_INFO
Definition Opcodes.hpp:1184
SERVER_DECL WDB::WDBContainer< WDB::Structures::LFGDungeonEntry > sLFGDungeonStore
Definition WDBStores.cpp:87
bool hasQuestFinished(uint32_t questId) const
Definition Player.cpp:8935
uint32_t GetFlags()
Reward info.
Definition LFGMgr.hpp:163
uint32_t variableMoney
Definition LFGMgr.hpp:168
uint32_t variableXP
Definition LFGMgr.hpp:169
struct LfgReward::@80 reward[2]
uint32_t questId
Definition LFGMgr.hpp:167
uint32_t GetRewardItemCount() const
uint32_t reward_item[4]
uint32_t reward_itemcount[4]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgProposalResultOpcode()

void WorldSession::handleLfgProposalResultOpcode ( WorldPacket recvPacket)
protected

Definition at line 584 of file LfgHandler.cpp.

585{
586#if VERSION_STRING > TBC
587 CmsgLfgProposalResult srlPacket;
588 if (!srlPacket.deserialise(recvPacket))
589 return;
590
591 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_LFG_PROPOSAL_RESULT guid {} proposal: {} accept: {}",
592 _player->getGuid(), srlPacket.lfgGroupId, srlPacket.accept ? 1 : 0);
593
594 sLfgMgr.UpdateProposal(srlPacket.lfgGroupId, _player->getGuid(), srlPacket.accept);
595#endif
596}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgSearchLeaveOpcode()

void WorldSession::handleLfgSearchLeaveOpcode ( WorldPacket recvPacket)
protected

Definition at line 572 of file LfgHandler.cpp.

573{
574#if VERSION_STRING > TBC
575 CmsgSearchLfgLeave srlPacket;
576 if (!srlPacket.deserialise(recvPacket))
577 return;
578
579 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_SEARCH_LFG_LEAVE for guid {} dungeonId: {}",
580 _player->getGuid(), srlPacket.entry);
581#endif
582}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgSearchOpcode()

void WorldSession::handleLfgSearchOpcode ( WorldPacket recvPacket)
protected

Definition at line 560 of file LfgHandler.cpp.

561{
562#if VERSION_STRING > TBC
563 CmsgSearchLfgJoin srlPacket;
564 if (!srlPacket.deserialise(recvPacket))
565 return;
566
567 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_SEARCH_LFG_JOIN for guid {} dungeon entry: {}",
568 _player->getGuid(), srlPacket.entry);
569#endif
570}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgSetBootVoteOpcode()

void WorldSession::handleLfgSetBootVoteOpcode ( WorldPacket recvPacket)
protected

Definition at line 615 of file LfgHandler.cpp.

616{
617#if VERSION_STRING > TBC
618 CmsgLfgSetBootVote srlPacket;
619 if (!srlPacket.deserialise(recvPacket))
620 return;
621
622 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_LFG_SET_BOOT_VOTE {} agree: {}",
623 _player->getGuid(), srlPacket.voteFor ? 1 : 0);
624
625 sLfgMgr.UpdateBoot(_player, srlPacket.voteFor);
626#endif
627}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgSetCommentOpcode()

void WorldSession::handleLfgSetCommentOpcode ( WorldPacket recvPacket)
protected

Definition at line 480 of file LfgHandler.cpp.

481{
482 CmsgSetLfgComment srlPacket;
483 if (!srlPacket.deserialise(recvPacket))
484 return;
485
486 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_SET_LFG_COMMENT playerGuid: {}, comment: {}", _player->getGuid(), srlPacket.comment);
487
488 sLfgMgr.SetComment(_player->getGuid(), srlPacket.comment);
489}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgSetRolesOpcode()

void WorldSession::handleLfgSetRolesOpcode ( WorldPacket recvPacket)
protected

Definition at line 598 of file LfgHandler.cpp.

599{
600#if VERSION_STRING > TBC
601 CmsgLfgSetRoles srlPacket;
602 if (!srlPacket.deserialise(recvPacket))
603 return;
604
605 if (auto grp = _player->getGroup())
606 {
607 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_LFG_SET_ROLES: Group {}, Player {}, Roles: {}",
608 grp->GetGUID(), _player->getGuid(), srlPacket.roles);
609
610 sLfgMgr.UpdateRoleCheck(grp->GetGUID(), _player->getGuid(), srlPacket.roles);
611 }
612#endif
613}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLfgTeleportOpcode()

void WorldSession::handleLfgTeleportOpcode ( WorldPacket recvPacket)
protected

Definition at line 712 of file LfgHandler.cpp.

713{
714#if VERSION_STRING > TBC
715 CmsgLfgTeleport srlPacket;
716 if (!srlPacket.deserialise(recvPacket))
717 return;
718
719 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_LFG_TELEPORT guid {} out: {}", _player->getGuid(), srlPacket.teleportOut ? 1 : 0);
720 sLfgMgr.TeleportPlayer(_player, srlPacket.teleportOut, true);
721#endif
722}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleListInventoryOpcode()

void WorldSession::handleListInventoryOpcode ( WorldPacket recvPacket)
protected

Definition at line 2279 of file ItemHandler.cpp.

2280{
2281 CmsgListInventory srlPacket;
2282 if (!srlPacket.deserialise(recvPacket))
2283 return;
2284
2285 WoWGuid wowGuid;
2286 wowGuid.Init(srlPacket.guid);
2287
2288 Creature* unit = _player->getWorldMap()->getCreature(wowGuid.getGuidLowPart());
2289 if (unit == nullptr)
2290 return;
2291
2292 MySQLStructure::VendorRestrictions const* vendor = sMySQLStore.getVendorRestriction(unit->GetCreatureProperties()->Id);
2293
2294 //this is a blizzlike check
2295 if (!_player->getTransGuid() && !unit->getTransGuid())
2296 {
2297 //avoid talking to anyone by guid hacking. Like sell farmed items anytime ? Low chance hack
2298 if (_player->getDistanceSq(unit) > 100)
2299 return;
2300 }
2301
2302 // makes npc stop when for example on its waypoint path // aaron02
2303 unit->pauseMovement(180000);
2304 unit->SetSpawnLocation(unit->GetPosition());
2305
2307
2308 if (_player->canBuyAt(vendor))
2309 sendInventoryList(unit);
2310 else
2312}
CreatureProperties const * GetCreatureProperties()
static void sendSimpleMenu(uint64_t guid, uint32_t textId, Player *player)
WDB::Structures::FactionEntry const * m_factionEntry
Definition Object.hpp:647
LocationVector GetPosition() const
Definition Object.hpp:373
float getDistanceSq(LocationVector target) const
Definition Object.cpp:588
void SetSpawnLocation(float newX, float newY, float newZ, float newOrientation)
Definition Object.hpp:360
bool canBuyAt(MySQLStructure::VendorRestrictions const *vendor)
Definition Player.cpp:10221
uint64_t getTransGuid()
Definition Unit.cpp:7998
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLoadScreenOpcode()

void WorldSession::handleLoadScreenOpcode ( WorldPacket recvPacket)
protected

Definition at line 1177 of file MiscHandler.cpp.

1178{
1179#if VERSION_STRING >= Cata
1180 uint32_t mapId;
1181
1182 recvPacket >> mapId;
1183 recvPacket.readBit();
1184#endif
1185}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLogDisconnectOpcode()

void WorldSession::handleLogDisconnectOpcode ( WorldPacket recvPacket)
protected

Definition at line 1050 of file MiscHandler.cpp.

1051{
1052#if VERSION_STRING >= Cata
1053 uint32_t disconnectReason;
1054 recvPacket >> disconnectReason; // 13 - closed window
1055
1056 sLogger.debug("Player {} disconnected on {} - Reason {}", _player->getName(), Util::GetCurrentDateTimeString(), disconnectReason);
1057#endif
1058}
std::string GetCurrentDateTimeString()
Returns the current Date Time as string.
Definition Util.cpp:164
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLogoutCancelOpcode()

void WorldSession::handleLogoutCancelOpcode ( WorldPacket )
protected

Definition at line 1105 of file MiscHandler.cpp.

1106{
1107 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_LOGOUT_CANCEL");
1108
1109 if (!LoggingOut)
1110 return;
1111
1112 LoggingOut = false;
1113
1114 SetLogoutTimer(0);
1115
1116 SendPacket(SmsgLogoutCancelAck().serialise().get());
1117
1118 _player->setMoveRoot(false);
1119
1121
1123
1124 sLogger.debug("Sent SMSG_LOGOUT_CANCEL_ACK");
1125}
@ UNIT_FLAG_LOCK_PLAYER
void setMoveRoot(bool set_root)
Definition Unit.cpp:2245
void SetLogoutTimer(uint32_t ms)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLogoutRequestOpcode()

void WorldSession::handleLogoutRequestOpcode ( WorldPacket )
protected

Definition at line 289 of file MiscHandler.cpp.

290{
291#if VERSION_STRING >= TBC // support classic
292 if (!sHookInterface.OnLogoutRequest(_player))
293 {
294 SendPacket(SmsgLogoutResponse(true).serialise().get());
295 return;
296 }
297
298 if (!hasPermissions())
299 {
301 {
302 SendPacket(SmsgLogoutResponse(true).serialise().get());
303 return;
304 }
305
306 if (_player->m_isResting || _player->isOnTaxi() || worldConfig.player.enableInstantLogoutForAccessType == 2)
307 {
309 return;
310 }
311 }
312
313 if (hasPermissions())
314 {
315 if (_player->m_isResting || _player->isOnTaxi() || worldConfig.player.enableInstantLogoutForAccessType > 0)
316 {
318 return;
319 }
320 }
321
322 SendPacket(SmsgLogoutResponse(false).serialise().get());
323
324 _player->setMoveRoot(true);
325 LoggingOut = true;
326
328
330
332#endif
333}
@ STANDSTATE_SIT
#define PLAYER_LOGOUT_DELAY
bool isInCombat() const
void addUnitFlags(uint32_t unitFlags)
Definition Unit.cpp:1109
CombatHandler & getCombatHandler()
Definition Unit.cpp:1803
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLootMasterGiveOpcode()

void WorldSession::handleLootMasterGiveOpcode ( WorldPacket recvPacket)
protected

Definition at line 524 of file LootHandler.cpp.

525{
526 CmsgLootMasterGive srlPacket;
527 if (!srlPacket.deserialise(recvPacket))
528 return;
529
530 if (_player->getGroup() == nullptr || _player->getGroup()->GetLooter() != _player->getPlayerInfo())
531 return;
532
533 auto player = _player->getWorldMap()->getPlayer(srlPacket.playerGuid.getGuidLow());
534 if (player == nullptr)
535 return;
536
537 if (_player->getLootGuid() != srlPacket.creatureGuid.getRawGuid())
538 return;
539
540 Creature* creature = nullptr;
541 Loot* loot = nullptr;
542
543 WoWGuid lootGuid;
544 lootGuid.Init(_player->getLootGuid());
545
546 if (lootGuid.isUnit())
547 {
548 creature = _player->getWorldMap()->getCreature(srlPacket.creatureGuid.getGuidLowPart());
549 if (creature == nullptr)
550 return;
551
552 loot = &creature->loot;
553 }
554 else if (lootGuid.isGameObject())
555 {
556 auto gameObject = _player->getWorldMap()->getGameObject(srlPacket.creatureGuid.getGuidLowPart());
557 if (gameObject == nullptr)
558 return;
559
560 if (!gameObject->IsLootable())
561 return;
562
563 auto gameObjectLootable = dynamic_cast<GameObject_Lootable*>(gameObject);
564 gameObject->setState(GO_STATE_OPEN);
565 loot = &gameObjectLootable->loot;
566 }
567
568 if (loot && srlPacket.slot >= loot->items.size())
569 {
570 sLogger.debug("AutoLootItem: Player {} might be using a hack! (slot {}, size {})", _player->getName(), srlPacket.slot, static_cast<uint32_t>(loot->items.size()));
571 return;
572 }
573
574 LootItem& item = srlPacket.slot >= loot->items.size() ? loot->quest_items[srlPacket.slot - loot->items.size()] : loot->items[srlPacket.slot];
575
576 // Add Item to Player
577 Item* newItem = player->storeItem(&item);
578 if (!newItem)
579 return;
580
581 if (creature)
582 {
583 if (creature->IsInWorld() && creature->isCreature() && creature->GetScript())
584 creature->GetScript()->OnLootTaken(player, item.itemproto);
585 }
586
587 // mark as looted
588 item.count = 0;
589 item.is_looted = true;
590
591 loot->itemRemoved(srlPacket.slot);
592 --loot->unlootedCount;
593}
@ GO_STATE_OPEN
void setState(uint8_t state)
CachedCharacterInfo * GetLooter(void)
Definition Group.h:206
Loot loot
Definition Unit.hpp:1221
uint8_t count
Definition LootItem.hpp:58
bool is_looted
Definition LootItem.hpp:74
ItemProperties const * itemproto
Definition LootItem.hpp:56
uint8_t unlootedCount
Definition Loot.hpp:43
std::vector< LootItem > items
Definition Loot.hpp:39
void itemRemoved(uint8_t slot)
Definition Loot.cpp:253
std::vector< LootItem > quest_items
Definition Loot.hpp:40
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLootMethodOpcode()

void WorldSession::handleLootMethodOpcode ( WorldPacket recvPacket)
private

Definition at line 677 of file GroupHandler.cpp.

678{
679 CmsgLootMethod srlPacket;
680 if (!srlPacket.deserialise(recvPacket))
681 return;
682
683 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_LOOT_METHOD: {} (method), {} (guidLow), {} (theshold)", srlPacket.method, srlPacket.guid.getGuidLow(), srlPacket.threshold);
684
685 if (!_player->isGroupLeader())
686 {
688 return;
689 }
690
691 const auto group = _player->getGroup();
692 if (group == nullptr)
693 return;
694
695 const auto lootMasterPlayer = sObjectMgr.getPlayer(srlPacket.guid.getGuidLow());
696 if (lootMasterPlayer == nullptr)
697 group->SetLooter(_player, static_cast<uint8_t>(srlPacket.method), static_cast<uint16_t>(srlPacket.threshold));
698 else
699 group->SetLooter(lootMasterPlayer, static_cast<uint8_t>(srlPacket.method), static_cast<uint16_t>(srlPacket.threshold));
700
701}
void SetLooter(Player *pPlayer, uint8_t method, uint16_t threshold)
Definition Group.cpp:563
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLootMoneyOpcode()

void WorldSession::handleLootMoneyOpcode ( WorldPacket )
protected

Definition at line 206 of file LootHandler.cpp.

207{
209
210 Unit* pt = nullptr;
211
212 WoWGuid wowGuid;
213 wowGuid.Init(_player->getLootGuid());
214
215 auto loot = getItemLootFromHighGuidType(wowGuid);
216 if (loot == nullptr)
217 return;
218
219 if (wowGuid.isUnit())
220 {
221 Creature* pCreature = _player->getWorldMap()->getCreature(wowGuid.getGuidLowPart());
222 if (!pCreature)
223 return;
224 pt = pCreature;
225 }
226 else if (wowGuid.isPlayer())
227 {
228 Player* pPlayer = _player->getWorldMap()->getPlayer(wowGuid.getGuidLowPart());
229 if (!pPlayer)
230 return;
231
232 pPlayer->m_lootableOnCorpse = false;
233 pt = pPlayer;
234 }
235
236 const uint32_t money = loot->gold;
237
238 // Notify Looters
239 loot->moneyRemoved();
240
241 // Clear Money
242 loot->gold = 0;
243
244 // Delete container if empty
245 if (loot->isLooted() && wowGuid.isItem())
246 _player->getSession()->doLootRelease(wowGuid);
247
248 if (!_player->isInGroup())
249 {
250 if (money)
251 {
252 if (worldConfig.player.isGoldCapEnabled && (_player->getCoinage() + money) > worldConfig.player.limitGoldAmount)
253 {
255 }
256 else
257 {
258 _player->modCoinage(money);
259 _player->getSession()->SendPacket(SmsgLootMoneyNotify(money, 1).serialise().get());
260#if VERSION_STRING > TBC
261 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, money);
262#endif
263 }
264 sHookInterface.OnLoot(_player, pt, money, 0);
265 }
266 }
267 else
268 {
269 if (const auto group = _player->getGroup())
270 {
271 std::vector<Player*> groupMembers;
272
273 groupMembers.reserve(group->MemberCount());
274
275 group->getLock().lock();
276 for (uint32_t i = 0; i < group->GetSubGroupCount(); i++)
277 {
278 auto subGroup = group->GetSubGroup(i);
279 for (auto groupMemberPlayerInfo : subGroup->getGroupMembers())
280 {
281 if (Player* loggedInPlayer = sObjectMgr.getPlayer(groupMemberPlayerInfo->guid))
282 if (loggedInPlayer->getZoneId() == _player->getZoneId() && _player->GetInstanceID() == loggedInPlayer->GetInstanceID())
283 groupMembers.push_back(loggedInPlayer);
284 }
285 }
286 group->getLock().unlock();
287
288 if (groupMembers.empty())
289 return;
290
291 const uint32_t sharedMoney = money / uint32_t(groupMembers.size());
292
293 // TODO: money is given to group members even if they are not near the looter
294 for (auto& player : groupMembers)
295 {
296 if (worldConfig.player.isGoldCapEnabled && (player->getCoinage() + sharedMoney) > worldConfig.player.limitGoldAmount)
297 {
298 player->getItemInterface()->buildInventoryChangeError(nullptr, nullptr, INV_ERR_TOO_MUCH_GOLD);
299 }
300 else
301 {
302 player->modCoinage(sharedMoney);
303 player->getSession()->SendPacket(SmsgLootMoneyNotify(sharedMoney, groupMembers.size() <= 1).serialise().get());
304
305#if VERSION_STRING > TBC
306 player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, sharedMoney);
307#endif
308 }
309 }
310 }
311 }
312}
int32_t GetInstanceID()
Definition Object.hpp:664
const uint32_t & getZoneId() const
Definition Object.hpp:469
bool m_lootableOnCorpse
Definition Player.hpp:1650
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLootOpcode()

void WorldSession::handleLootOpcode ( WorldPacket recvPacket)
protected

Definition at line 314 of file LootHandler.cpp.

315{
316 CmsgLoot srlPacket;
317 if (!srlPacket.deserialise(recvPacket))
318 return;
319
320 if (_player->isDead())
321 return;
322
323 if (_player->isStealthed())
325
327
328 if (_player->isInvisible())
330
331 std::vector<uint64_t> onlineGroupMembers;
332
333 if (_player->isInGroup() && !_player->m_bg)
334 {
335 if (auto group = _player->getGroup())
336 {
337 if (group->GetMethod() == PARTY_LOOT_MASTER_LOOTER)
338 {
339 group->Lock();
340 for (uint32_t i = 0; i < group->GetSubGroupCount(); ++i)
341 {
342 if (auto subGroup = group->GetSubGroup(i))
343 {
344 for (auto groupMemberPlayerInfo : subGroup->getGroupMembers())
345 {
346 if (Player* loggedInPlayer = sObjectMgr.getPlayer(groupMemberPlayerInfo->guid))
347 if (_player->getZoneId() == loggedInPlayer->getZoneId())
348 onlineGroupMembers.push_back(loggedInPlayer->getGuid());
349 }
350 }
351 }
352 group->Unlock();
353
354 group->SendPacketToAll(SmsgLootMasterList(onlineGroupMembers).serialise().get());
355 }
356 }
357 }
359}
@ SPELL_AURA_MOD_INVISIBILITY
@ PARTY_LOOT_MASTER_LOOTER
@ LOOT_CORPSE
void sendLoot(uint64_t guid, uint8_t loot_type, uint32_t mapId)
Definition Player.cpp:10791
bool isInvisible() const
Definition Unit.cpp:6230
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLootReleaseOpcode()

void WorldSession::handleLootReleaseOpcode ( WorldPacket recvPacket)
protected

Definition at line 361 of file LootHandler.cpp.

362{
363 CmsgLootRelease srlPacket;
364 if (!srlPacket.deserialise(recvPacket))
365 return;
366
367 if (uint64_t lguid = GetPlayer()->getLootGuid())
368 if (lguid == srlPacket.guid.getRawGuid())
369 doLootRelease(srlPacket.guid);
370}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleLootRollOpcode()

void WorldSession::handleLootRollOpcode ( WorldPacket recvPacket)
protected

Definition at line 575 of file MiscHandler.cpp.

576{
577 CmsgLootRoll srlPacket;
578 if (!srlPacket.deserialise(recvPacket))
579 return;
580
581 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_LOOT_ROLL: {} (objectGuid) {} (slot) {} (choice)", srlPacket.objectGuid.getGuidLow(), srlPacket.slot, srlPacket.choice);
582
583 LootItem* lootItem = nullptr;
584
585 const HighGuid guidType = srlPacket.objectGuid.getHigh();
586
587 switch (guidType)
588 {
590 {
591 auto gameObject = _player->getWorldMap()->getGameObject(srlPacket.objectGuid.getGuidLowPart());
592 if (gameObject == nullptr)
593 return;
594
595 if (!gameObject->IsLootable())
596 return;
597
598 auto gameObjectLootable = static_cast<GameObject_Lootable*>(gameObject);
599 if (srlPacket.slot >= gameObjectLootable->loot.items.size() || gameObjectLootable->loot.items.empty())
600 return;
601
602 if (gameObject->getGoType() == GAMEOBJECT_TYPE_CHEST)
603 lootItem = &gameObjectLootable->loot.items[srlPacket.slot];
604 } break;
605 case HighGuid::Unit:
606 {
607 auto creature = _player->getWorldMap()->getCreature(srlPacket.objectGuid.getGuidLowPart());
608 if (creature == nullptr)
609 return;
610
611 if (srlPacket.slot >= creature->loot.items.size() || creature->loot.items.empty())
612 return;
613
614 lootItem = &creature->loot.items[srlPacket.slot];
615 } break;
616 default:
617 return;
618 }
619
620 if (lootItem == nullptr)
621 return;
622
623 lootItem->playerRolled(_player, srlPacket.choice);
624}
HighGuid
Definition WoWGuid.h:59
void playerRolled(Player *player, uint8_t choice)
Definition LootItem.cpp:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMailCreateTextItemOpcode()

void WorldSession::handleMailCreateTextItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 130 of file MailHandler.cpp.

131{
132 CmsgMailCreateTextItem srlPacket;
133 if (!srlPacket.deserialise(recvPacket))
134 return;
135
136 const auto itemProperties = sMySQLStore.getItemProperties(8383);
137 auto message = _player->m_mailBox->GetMessageById(srlPacket.messageId);
138 if (message == nullptr || !itemProperties)
139 {
141 return;
142 }
143
144 const auto slotResult = _player->getItemInterface()->FindFreeInventorySlot(itemProperties);
145 if (slotResult.Result == 0)
146 {
148 return;
149 }
150
151 auto item = sObjectMgr.createItem(8383, _player);
152 if (item == nullptr)
153 return;
154
155 item->setFlags(ITEM_FLAG_WRAP_GIFT);
156 item->setText(message->body);
157
158 // TODO: if add fails, should item be sent in mail? now it's destroyed
159 const auto [addResult, _] = _player->getItemInterface()->AddItemToFreeSlot(std::move(item));
160 if (addResult)
162}
@ ITEM_FLAG_WRAP_GIFT
@ MAIL_RES_MADE_PERMANENT
Definition MailMgr.h:41
@ MAIL_OK
Definition MailMgr.h:66
@ MAIL_ERR_INTERNAL_ERROR
Definition MailMgr.h:72
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMailDeleteOpcode()

void WorldSession::handleMailDeleteOpcode ( WorldPacket recvPacket)
protected

Definition at line 50 of file MailHandler.cpp.

51{
52 CmsgMailDelete srlPacket;
53 if (!srlPacket.deserialise(recvPacket))
54 return;
55
56 const auto mailMessage = _player->m_mailBox->GetMessageById(srlPacket.messageId);
57 if (mailMessage == nullptr)
58 {
60 return;
61 }
62
63 _player->m_mailBox->DeleteMessage(srlPacket.messageId, true);
64
66}
@ MAIL_RES_DELETED
Definition MailMgr.h:40
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMailTimeOpcode()

void WorldSession::handleMailTimeOpcode ( WorldPacket )
protected

Definition at line 183 of file MailHandler.cpp.

184{
186 {
187 uint32_t unreadMessageCount = 0;
188 data << uint32_t(0);
189 data << uint32_t(0);
190
191 for (auto& message : _player->m_mailBox->Messages)
192 {
193 if (message.second.checked_flag & MAIL_CHECK_MASK_READ)
194 continue;
195
196 if (message.second.deleted_flag == 0 && static_cast<uint32_t>(UNIXTIME) >= message.second.delivery_time)
197 {
198 ++unreadMessageCount;
199 data << uint64_t(message.second.sender_guid);
200 data << uint32_t(message.second.message_type != MAIL_TYPE_NORMAL ? message.second.sender_guid : 0);
201 data << uint32_t(message.second.message_type);
202 data << uint32_t(message.second.stationery);
203 data << float(message.second.delivery_time - static_cast<uint32_t>(UNIXTIME));
204 }
205 }
206
207 if (unreadMessageCount == 0)
208 data.put<uint32_t>(0, 0xc7a8c000);
209 else
210 data.put<uint32_t>(4, unreadMessageCount);
211 }
212
213 SendPacket(&data);
214}
@ MAIL_CHECK_MASK_READ
Definition MailMgr.h:100
@ MSG_QUERY_NEXT_MAIL_TIME
Definition Opcodes.hpp:707
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMarkAsReadOpcode()

void WorldSession::handleMarkAsReadOpcode ( WorldPacket recvPacket)
protected

Definition at line 31 of file MailHandler.cpp.

32{
33 CmsgMailMarkAsRead srlPacket;
34 if (!srlPacket.deserialise(recvPacket))
35 return;
36
37 auto mailMessage = _player->m_mailBox->GetMessageById(srlPacket.messageId);
38 if (mailMessage == nullptr)
39 return;
40
41 mailMessage->checked_flag |= MAIL_CHECK_MASK_READ;
42
43 if (!sMailSystem.MailOption(MAIL_FLAG_NO_EXPIRY))
44 mailMessage->expire_time = static_cast<uint32_t>(UNIXTIME) + (TimeVars::Day * 30);
45
46 CharacterDatabase.WaitExecute("UPDATE mailbox SET checked_flag = %u, expiry_time = %u WHERE message_id = %u",
47 mailMessage->checked_flag, mailMessage->expire_time, mailMessage->message_id);
48}
@ MAIL_FLAG_NO_EXPIRY
Definition MailMgr.h:51
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMessageChatOpcode()

void WorldSession::handleMessageChatOpcode ( WorldPacket recvPacket)
protected

Definition at line 128 of file ChatHandler.cpp.

129{
130 CmsgMessageChat srlPacket;
131 if (!srlPacket.deserialise(recvPacket))
132 return;
133
134 auto messageLanguage = srlPacket.language;
135 auto player_can_speak_language = true;
136
137 if (messageLanguage != LANG_ADDON)
138 {
139 if (const auto language_skill = LanguageSkills[messageLanguage])
140 player_can_speak_language = _player->hasSkillLine(language_skill);
141
142 if (worldConfig.player.isInterfactionChatEnabled)
143 {
144 messageLanguage = LANG_UNIVERSAL;
145 player_can_speak_language = true;
146 }
147
148 if (_player->m_modlanguage >= 0)
149 {
150 messageLanguage = _player->m_modlanguage;
151 player_can_speak_language = true;
152 }
153
154 // GMs speak universal language
155 if (hasPermissions())
156 {
157 messageLanguage = LANG_UNIVERSAL;
158 player_can_speak_language = true;
159 }
160 }
161
163 return;
164
165 switch (srlPacket.type)
166 {
167 case CHAT_MSG_EMOTE:
168 case CHAT_MSG_SAY:
169 case CHAT_MSG_YELL:
170 case CHAT_MSG_WHISPER:
171 case CHAT_MSG_CHANNEL:
172 {
173 if (m_muted >= static_cast<uint32_t>(UNIXTIME))
174 {
175 SystemMessage("You are currently muted by a moderator.");
176 return;
177 }
178 } break;
179 default:
180 break;
181 }
182
183 if (srlPacket.message.find("|T") > -1)
184 {
185 //_player->broadcastMessage("Don't even THINK about doing that again");
186 return;
187 }
188
189 if (!sHookInterface.OnChat(_player, srlPacket.type, srlPacket.language, srlPacket.message.c_str(), srlPacket.destination.c_str()))
190 return;
191
192 if (g_chatFilter->isBlockedOrReplaceWord(srlPacket.message))
193 {
194 SystemMessage("Your chat message was blocked by a server-side filter.");
195 return;
196 }
197
198 switch (srlPacket.type)
199 {
200 case CHAT_MSG_SAY:
201 case CHAT_MSG_PARTY:
203 case CHAT_MSG_RAID:
206 case CHAT_MSG_GUILD:
207 case CHAT_MSG_OFFICER:
208 case CHAT_MSG_YELL:
209 {
210 // Parse command and get out of the message handling :-)
211 if (sChatHandler.ParseCommands(srlPacket.message.c_str(), this) > 0)
212 return;
213 }
214 }
215
216 uint8_t gmFlag = _player->isGMFlagSet() ? 4 : 0;
217 switch (srlPacket.type)
218 {
219 case CHAT_MSG_EMOTE:
220 {
221 // TODO Verify "strange gestures" for xfaction
222 _player->sendMessageToSet(SmsgMessageChat(CHAT_MSG_EMOTE, messageLanguage, gmFlag, srlPacket.message, _player->getGuid()).serialise().get(), true, true);
223 sLogger.info("[emote] {}: {}", _player->getName(), srlPacket.message);
224 } break;
225 case CHAT_MSG_SAY:
226 {
227 if (!player_can_speak_language)
228 break;
229
230 _player->sendMessageToSet(SmsgMessageChat(CHAT_MSG_SAY, messageLanguage, gmFlag, srlPacket.message, _player->getGuid()).serialise().get(), true);
231 } break;
232 case CHAT_MSG_PARTY:
234 case CHAT_MSG_RAID:
237 {
238 if (!player_can_speak_language)
239 break;
240
241#if VERSION_STRING >= Cata
242 // Use correct type for group/raid leader
243 if (srlPacket.type == CHAT_MSG_PARTY || srlPacket.type == CHAT_MSG_RAID)
244 {
245 if (auto const group = _player->getGroup())
246 if (group->GetLeader() == _player->getPlayerInfo())
248 }
249#endif
250
251 const auto send_packet = SmsgMessageChat(static_cast<uint8_t>(srlPacket.type), messageLanguage, gmFlag, srlPacket.message, _player->getGuid()).serialise();
252
253 if (auto const group = _player->getGroup())
254 {
255 if (srlPacket.type == CHAT_MSG_PARTY || srlPacket.type == CHAT_MSG_PARTY_LEADER && group->isRaid())
256 {
257 if (auto* const subgroup = group->GetSubGroup(_player->getSubGroupSlot()))
258 {
259 group->Lock();
260 for (auto group_member : subgroup->getGroupMembers())
261 if (Player* loggedInPlayer = sObjectMgr.getPlayer(group_member->guid))
262 loggedInPlayer->sendPacket(send_packet.get());
263 group->Unlock();
264 }
265 }
266 else
267 {
268 for (uint32_t i = 0; i < group->GetSubGroupCount(); ++i)
269 {
270 if (auto* const sub_group = group->GetSubGroup(i))
271 {
272 group->Lock();
273 for (auto group_member : sub_group->getGroupMembers())
274 if (Player* loggedInPlayer = sObjectMgr.getPlayer(group_member->guid))
275 loggedInPlayer->sendPacket(send_packet.get());
276 group->Unlock();
277 }
278 }
279 }
280 sLogger.info("[party] {}: {}", _player->getName(), srlPacket.message);
281 }
282 } break;
283 case CHAT_MSG_GUILD:
284 {
285 if (auto* const guild = _player->getGuild())
286 guild->broadcastToGuild(this, false, srlPacket.message, messageLanguage);
287 } break;
288 case CHAT_MSG_OFFICER:
289 {
290 if (auto* const guild = _player->getGuild())
291 guild->broadcastToGuild(this, true, srlPacket.message, messageLanguage);
292 } break;
293 case CHAT_MSG_YELL:
294 {
295 if (!player_can_speak_language)
296 break;
297
298 auto yell_packet = SmsgMessageChat(CHAT_MSG_YELL, messageLanguage, gmFlag, srlPacket.message, _player->getGuid());
299 _player->getWorldMap()->sendChatMessageToCellPlayers(_player, yell_packet.serialise().get(), 2, 1, messageLanguage, this);
300 } break;
301 case CHAT_MSG_WHISPER:
302 {
303 if (auto* const playerTarget = sObjectMgr.getPlayer(srlPacket.destination.c_str(), false))
304 {
305 const auto target_is_our_faction = _player->getInitialTeam() == playerTarget->getInitialTeam();
306 const auto target_is_gm_flagged = playerTarget->hasPlayerFlags(PLAYER_FLAG_GM);
307 if (target_is_our_faction || worldConfig.player.isInterfactionChatEnabled || target_is_gm_flagged)
308 {
309 const auto target_gm_is_speaking_to_us = playerTarget->isOnGMTargetList(_player->getGuidLow());
310 if (!gmFlag && target_is_gm_flagged && target_gm_is_speaking_to_us)
311 {
312 std::string reply = "SYSTEM: This Game Master does not currently have an open ticket from you and did not receive your whisper. Please submit a new GM Ticket request if you need to speak to a GM. This is an automatic message.";
313 SendPacket(SmsgMessageChat(CHAT_MSG_WHISPER_INFORM, LANG_UNIVERSAL, gmFlag, reply, playerTarget->getGuid()).serialise().get());
314 break;
315 }
316
317 const auto we_are_being_ignored = playerTarget->isIgnored(_player->getGuidLow());
318 if (we_are_being_ignored)
319 {
320 SendPacket(SmsgMessageChat(CHAT_MSG_IGNORED, LANG_UNIVERSAL, gmFlag, srlPacket.message, playerTarget->getGuid()).serialise().get());
321 break;
322 }
323
324 playerTarget->sendPacket(SmsgMessageChat(CHAT_MSG_WHISPER, messageLanguage, gmFlag, srlPacket.message, _player->getGuid()).serialise().get());
325 if (messageLanguage != LANG_ADDON)
326 {
327 // TODO Verify should this be LANG_UNIVERSAL?
328 SendPacket(SmsgMessageChat(CHAT_MSG_WHISPER_INFORM, LANG_UNIVERSAL, gmFlag, srlPacket.message, playerTarget->getGuid()).serialise().get());
329 }
330
331 if (playerTarget->hasPlayerFlags(PLAYER_FLAG_AFK))
332 {
333 std::string reason = playerTarget->getAFKReason();
334 SendPacket(SmsgMessageChat(CHAT_MSG_AFK, LANG_UNIVERSAL, gmFlag, reason, playerTarget->getGuid()).serialise().get());
335 }
336 else if (playerTarget->hasPlayerFlags(PLAYER_FLAG_DND))
337 {
338 std::string reason = playerTarget->getAFKReason();
339 SendPacket(SmsgMessageChat(CHAT_MSG_DND, LANG_UNIVERSAL, gmFlag, reason, playerTarget->getGuid()).serialise().get());
340 }
341 }
342 }
343 else
344 {
346 }
347 } break;
348 case CHAT_MSG_CHANNEL:
349 {
350 if (auto channel = sChannelMgr.getChannel(srlPacket.destination, _player))
351 channel->say(_player, srlPacket.message, nullptr, false);
352
353 } break;
354 case CHAT_MSG_AFK:
355 {
356 _player->setAFKReason(srlPacket.message);
358 } break;
359 case CHAT_MSG_DND:
360 {
361 _player->setAFKReason(srlPacket.message);
363 } break;
366 {
367 if (!player_can_speak_language || !_player->m_bg)
368 break;
369
370#if VERSION_STRING >= Cata
371 // Use correct type for group leader
372 if (auto const group = _player->getGroup())
373 if (group->GetLeader() == _player->getPlayerInfo())
375#endif
376
377 _player->m_bg->distributePacketToTeam(SmsgMessageChat(static_cast<uint8_t>(srlPacket.type), messageLanguage, gmFlag, srlPacket.message, _player->getGuid()).serialise().get(), _player->getTeam());
378 } break;
379 default:
380 break;
381 }
382}
#define sChatHandler
@ CHAT_MSG_RAID_WARNING
@ CHAT_MSG_RAID
@ CHAT_MSG_SAY
@ CHAT_MSG_PARTY_LEADER
@ CHAT_MSG_RAID_LEADER
@ CHAT_MSG_DND
@ CHAT_MSG_WHISPER_INFORM
@ CHAT_MSG_YELL
@ CHAT_MSG_PARTY
@ CHAT_MSG_WHISPER
@ CHAT_MSG_EMOTE
@ CHAT_MSG_GUILD
@ CHAT_MSG_OFFICER
@ CHAT_MSG_AFK
@ CHAT_MSG_BATTLEGROUND
@ CHAT_MSG_BATTLEGROUND_LEADER
@ CHAT_MSG_CHANNEL
@ LANG_ADDON
static const uint16_t LanguageSkills[NUM_LANGUAGES]
@ PLAYER_FLAG_AFK
@ PLAYER_FLAG_GM
@ PLAYER_FLAG_DND
std::unique_ptr< WordFilter > g_chatFilter
void distributePacketToTeam(WorldPacket *packet, uint32_t Team)
int8_t getSubGroupSlot() const
Definition Player.cpp:7898
void toggleAfk()
Definition Player.cpp:2854
void sendMessageToSet(WorldPacket *data, bool sendToSelf, bool sendToOwnTeam=false) override
Definition Player.cpp:3192
void setAFKReason(std::string reason)
Definition Player.cpp:2396
void toggleDnd()
Definition Player.cpp:2875
uint32_t getInitialTeam() const
Definition Player.cpp:2779
int32_t m_modlanguage
Definition Unit.hpp:1002
void sendChatMessageToCellPlayers(Object *obj, WorldPacket *packet, uint32_t cell_radius, uint32_t langpos, int32_t lang, WorldSession *originator)
bool isSessionMuted()
bool isFloodProtectionTriggered()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMinimapPingOpcode()

void WorldSession::handleMinimapPingOpcode ( WorldPacket recvPacket)
private

Definition at line 627 of file GroupHandler.cpp.

628{
629 MsgMinimapPing srlPacket;
630 if (!srlPacket.deserialise(recvPacket))
631 return;
632
633 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_MINIMAP_PING: {} (x), {} (y)", srlPacket.posX, srlPacket.posY);
634
635 if (!_player->isInGroup())
636 return;
637
638 const auto group = _player->getGroup();
639 if (group == nullptr)
640 return;
641
642 group->SendPacketToAllButOne(MsgMinimapPing(_player->getGuid(), srlPacket.posX, srlPacket.posY).serialise().get(), _player);
643}
void SendPacketToAllButOne(WorldPacket *packet, Player *pSkipTarget)
Definition Group.cpp:575
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HandleMirrorImageOpcode()

void WorldSession::HandleMirrorImageOpcode ( WorldPacket recvPacket)
protected

Definition at line 2404 of file MiscHandler.cpp.

2405{
2406 if (!_player->IsInWorld())
2407 return;
2408
2409 sLogger.debug("Received CMG_GET_MIRRORIMAGE_DATA");
2410
2411 uint64_t GUID;
2412
2413 recv_data >> GUID;
2414
2415 Unit* Image = _player->getWorldMap()->getUnit(GUID);
2416 if (Image == nullptr)
2417 return; // ups no unit found with that GUID on the map. Spoofed packet?
2418
2419 if (Image->getCreatedByGuid() == 0)
2420 return;
2421
2422 uint64_t CasterGUID = Image->getCreatedByGuid();
2423 Unit* Caster = _player->getWorldMap()->getUnit(CasterGUID);
2424
2425 if (Caster == nullptr)
2426 return; // apperantly this mirror image mirrors nothing, poor lonely soul :(Maybe it's the Caster's ghost called Casper
2427
2429
2430 data << uint64_t(GUID);
2431 data << uint32_t(Caster->getDisplayId());
2432 data << uint8_t(Caster->getRace());
2433
2434 if (Caster->isPlayer())
2435 {
2436 if (const auto pcaster = dynamic_cast<Player*>(Caster))
2437 {
2438 data << uint8_t(pcaster->getGender());
2439 data << uint8_t(pcaster->getClass());
2440
2441 // facial features
2442 data << uint8_t(pcaster->getSkinColor());
2443 data << uint8_t(pcaster->getFace());
2444 data << uint8_t(pcaster->getHairStyle());
2445 data << uint8_t(pcaster->getHairColor());
2446 data << uint8_t(pcaster->getFacialFeatures());
2447
2448 if (pcaster->isInGuild())
2449 data << uint32_t(pcaster->getGuildId());
2450 else
2451 data << uint32_t(0);
2452
2453 static const uint32_t imageitemslots[] =
2454 {
2466 };
2467
2468 for (uint8_t i = 0; i < 11; ++i)
2469 {
2470 Item* item = pcaster->getItemInterface()->GetInventoryItem(static_cast <int16_t> (imageitemslots[i]));
2471 if (item != nullptr)
2472 data << uint32_t(item->getItemProperties()->DisplayInfoID);
2473 else
2474 data << uint32_t(0);
2475 }
2476 }
2477 }
2478 else // do not send player data for creatures
2479 {
2480 data << uint8_t(0);
2481 data << uint32_t(0);
2482 data << uint32_t(0);
2483 data << uint32_t(0);
2484 data << uint32_t(0);
2485 data << uint32_t(0);
2486 data << uint32_t(0);
2487 data << uint32_t(0);
2488 data << uint32_t(0);
2489 data << uint32_t(0);
2490 data << uint32_t(0);
2491 data << uint32_t(0);
2492 data << uint32_t(0);
2493 data << uint32_t(0);
2494 }
2495
2496 SendPacket(&data);
2497
2498 sLogger.debug("Sent SMSG_MIRRORIMAGE_DATA");
2499}
@ EQUIPMENT_SLOT_SHOULDERS
@ EQUIPMENT_SLOT_BODY
@ EQUIPMENT_SLOT_HANDS
@ EQUIPMENT_SLOT_TABARD
@ EQUIPMENT_SLOT_HEAD
@ EQUIPMENT_SLOT_LEGS
@ EQUIPMENT_SLOT_BACK
@ EQUIPMENT_SLOT_WAIST
@ EQUIPMENT_SLOT_FEET
@ EQUIPMENT_SLOT_CHEST
@ EQUIPMENT_SLOT_WRISTS
@ SMSG_MIRRORIMAGE_DATA
Definition Opcodes.hpp:1113
bool isPlayer() const
Definition Object.cpp:569
uint32_t getDisplayId() const
Definition Unit.cpp:1252
uint64_t getCreatedByGuid() const
Definition Unit.cpp:397
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMountSpecialAnimOpcode()

void WorldSession::handleMountSpecialAnimOpcode ( WorldPacket )
protected

Definition at line 571 of file MovementHandler.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMovementOpcodes()

void WorldSession::handleMovementOpcodes ( WorldPacket recvPacket)
protected

Set up some vars to simplify code. We use the internal opcode id for Multiversion support

read movement info from packet

out of bounds check

stop using go on movement

hack detected?

Lets update our internal save vars

Remove emote state if available

Falling damage

Transport position

Breathing & Underwaterstate

Aura Interruption

send our move to all inrange players

Update our Server position

Definition at line 155 of file MovementHandler.cpp.

156{
158 return;
159
160 //////////////////////////////////////////////////////////////////////////////////////////
161 /// Set up some vars to simplify code. We use the internal opcode id for Multiversion support
162 // Zyres: save the opcode here for better handling
163 const auto opcode = sOpcodeTables.getInternalIdForHex(recvData.GetOpcode());
164
165 // Zyres: We (the player) controles the movement of us or another player/unit.
166 // this is always initialise with the player, can be changed to any other unit.
167 Unit* mover = _player->m_controledUnit;
168
169 // Zyres: Clear standing state to stand... investigate further if this is really needed
170 if (mover->getStandState() != STANDSTATE_STAND && opcode == MSG_MOVE_START_FORWARD)
172
173 //////////////////////////////////////////////////////////////////////////////////////////
174 /// read movement info from packet
175 MovementInfo movementInfo;
176 recvData >> movementInfo;
177
178 // store the read movementInfo here. We will need it for other functions related to this handler (e.g. updatePlayerMovementVars)
179 sessionMovementInfo = movementInfo;
180
181 // Zyres: now we have the data from the movement packet. Check out if we are the mover, otherwise stop processing
182#if VERSION_STRING > TBC
183 // wotlk check
184 if (sessionMovementInfo.guid != mover->getGuid())
185 return;
186#endif
187
188 //////////////////////////////////////////////////////////////////////////////////////////
189 /// out of bounds check
190 {
191 bool out_of_bounds = false;
192 out_of_bounds = out_of_bounds || sessionMovementInfo.position.y < Map::Terrain::_minY;
193 out_of_bounds = out_of_bounds || sessionMovementInfo.position.y > Map::Terrain::_maxY;
194 out_of_bounds = out_of_bounds || sessionMovementInfo.position.x > Map::Terrain::_maxX;
195 out_of_bounds = out_of_bounds || sessionMovementInfo.position.x > Map::Terrain::_maxX;
196
197 if (out_of_bounds)
198 {
199 Disconnect();
200 return;
201 }
202 }
203
204 //////////////////////////////////////////////////////////////////////////////////////////
205 /// stop using go on movement
206 if (auto* const summoned_object = _player->m_summonedObject)
207 {
208 if (summoned_object->isGameObject())
209 {
210 auto* const go = dynamic_cast<GameObject*>(summoned_object);
211 if (go->isFishingNode())
212 {
213 // This is done separately as not all channeled spells are canceled by all movement opcodes
215 {
216 spell->cancel();
217 }
218 }
219 }
220 }
221
222 //////////////////////////////////////////////////////////////////////////////////////////
223 /// hack detected?
225 {
226 return;
227 }
228
229 //////////////////////////////////////////////////////////////////////////////////////////
230 /// Lets update our internal save vars
232
233 //////////////////////////////////////////////////////////////////////////////////////////
234 /// Remove emote state if available
235 if (mover->getEmoteState())
237
238 //////////////////////////////////////////////////////////////////////////////////////////
239 /// Falling damage
240
241 // Zyres: Spell realted "blinking"
242 if (_player->m_blinked)
243 {
244 _player->m_blinked = false;
247 }
248 else
249 {
250 if (opcode == MSG_MOVE_FALL_LAND)
251 {
253 }
254 else
255 {
256 // whilst player is not falling, continuously update Z axis position.
257 // once player lands, this will be used to determine how far he fell.
260 }
261 }
262
263 //////////////////////////////////////////////////////////////////////////////////////////
264 /// Transport position
265#if VERSION_STRING <= WotLK
266 if (movementInfo.hasMovementFlag(MOVEFLAG_TRANSPORT))
267 {
268 // if we boarded a transport, add us to it
269 if (mover->isPlayer())
270 {
271 if (!mover->GetTransport())
272 {
273 if (Transporter* transport = sTransportHandler.getTransporter(WoWGuid::getGuidLowPartFromUInt64(movementInfo.transport_guid)))
274 {
275 transport->AddPassenger(mover->ToPlayer());
276
277 /* set variables */
283 }
284 }
285 else if (mover->GetTransport() != sTransportHandler.getTransporter(WoWGuid::getGuidLowPartFromUInt64(movementInfo.transport_guid)))
286 {
287 mover->GetTransport()->RemovePassenger(mover);
288 if (Transporter* transport = sTransportHandler.getTransporter(WoWGuid::getGuidLowPartFromUInt64(movementInfo.transport_guid)))
289 {
290 transport->AddPassenger(mover->ToPlayer());
291
292 /* set variables */
298 }
299 else
300 {
301 movementInfo.clearTransportData();
303 }
304 }
305 else
306 {
307 /* set variables */
309#if VERSION_STRING > TBC
310 mover->obj_movement_info.transport_seat = movementInfo.transport_seat;
311#endif
316 }
317 }
318#ifdef FT_VEHICLES
319 // Transports like Elevators
320 if (!mover->GetTransport() && !mover->getVehicle())
321 {
322 GameObject* go = mover->getWorldMapGameObject(movementInfo.transport_guid);
323 if (!go || go->getOType() != GAMEOBJECT_TYPE_TRANSPORT)
325 }
326#else
327 // Transports like Elevators
328 if (!mover->GetTransport())
329 {
330 GameObject* go = mover->getWorldMapGameObject(movementInfo.transport_guid);
331 if (!go || go->getOType() != GAMEOBJECT_TYPE_TRANSPORT)
333 }
334#endif
335 }
336 else if (mover->ToPlayer() && mover->GetTransport()) // if we were on a transport, leave
337 {
338 mover->GetTransport()->RemovePassenger(mover);
339 movementInfo.clearTransportData();
340 }
341#else
342 if (mover->isPlayer())
343 {
344 // if we boarded a transport, add us to it
345 if (movementInfo.transport_guid)
346 {
347 if (!mover->GetTransport())
348 {
349 if (Transporter* transport = sTransportHandler.getTransporter(WoWGuid::getGuidLowPartFromUInt64(movementInfo.transport_guid)))
350 {
351 transport->AddPassenger(mover->ToPlayer());
352
353 /* set variables */
359 }
360 }
361 else if (mover->GetTransport()->getGuid() != movementInfo.transport_guid)
362 {
363 mover->GetTransport()->RemovePassenger(mover);
364 if (Transporter* transport = sTransportHandler.getTransporter(WoWGuid::getGuidLowPartFromUInt64(movementInfo.transport_guid)))
365 {
366 transport->AddPassenger(mover->ToPlayer());
367
368 /* set variables */
374 }
375 else
376 {
377 movementInfo.clearTransportData();
379 }
380 }
381 else
382 {
383 /* set variables */
385 mover->obj_movement_info.transport_seat = movementInfo.transport_seat;
390 }
391
392 // Transports like Elevators
393 if (!mover->GetTransport() && !mover->getVehicle())
394 {
395 GameObject* go = mover->getWorldMapGameObject(movementInfo.transport_guid);
396 if (!go || go->getGoType() != GAMEOBJECT_TYPE_TRANSPORT)
397 movementInfo.transport_guid = 0;
398 }
399 }
400 else if (mover && mover->GetTransport())
401 {
402 // if we were on a transport, leave
403 mover->GetTransport()->RemovePassenger(mover);
404 movementInfo.clearTransportData();
406 }
407 }
408#endif
409
410 //////////////////////////////////////////////////////////////////////////////////////////
411 /// Breathing & Underwaterstate
413
414 //////////////////////////////////////////////////////////////////////////////////////////
415 /// Aura Interruption
417
418 //////////////////////////////////////////////////////////////////////////////////////////
419 /// send our move to all inrange players
420
421#if VERSION_STRING >= Cata
422
423 WorldPacket data(SMSG_PLAYER_MOVE, recvData.size());
424 data << sessionMovementInfo;
425 mover->sendMessageToSet(&data, false);
426
427#elif VERSION_STRING == WotLK
428
429 WorldPacket data(opcode, recvData.size());
430 data << sessionMovementInfo;
431 mover->sendMessageToSet(&data, _player);
432
433#else
434
435 // Zyres NOTE: versions older than WotLK do not send us the guid within the movement packet (needed for the packet send to other players)
436 // but we should already received the active mover
438
439 WorldPacket data(opcode, recvData.size());
440 data << sessionMovementInfo;
441 mover->sendMessageToSet(&data, false);
442
443#endif
444
445#ifdef FT_VEHICLES
446 //////////////////////////////////////////////////////////////////////////////////////////
447 /// Some vehicles allow the passenger to turn by himself
448 if (Vehicle* vehicle = mover->getVehicle())
449 {
450 if (auto const* seat = vehicle->getSeatForPassenger(mover))
451 {
453 {
454 if (movementInfo.position.getOrientation() != mover->GetOrientation())
455 {
457 mover->SetOrientation(movementInfo.position.getOrientation());
458 }
459 }
460 }
461 return;
462 }
463#endif
464
465 //////////////////////////////////////////////////////////////////////////////////////////
466 /// Update our Server position
468}
@ AURA_INTERRUPT_ON_TURNING
@ GAMEOBJECT_TYPE_TRANSPORT
@ MOVEFLAG_TRANSPORT
@ MOVEFLAG_FALLING
@ MSG_MOVE_START_FORWARD
Definition Opcodes.hpp:218
@ MSG_MOVE_FALL_LAND
Definition Opcodes.hpp:239
@ SMSG_PLAYER_MOVE
Definition Opcodes.hpp:1703
#define sTransportHandler
@ EMOTE_ONESHOT_NONE
float getOrientation() const
uint16_t getOType() const
Definition Object.cpp:346
const float & GetOrientation() const
Definition Object.hpp:357
void SetOrientation(float o)
Definition Object.hpp:358
GameObject * getWorldMapGameObject(const uint64_t &guid) const
Definition Object.cpp:4608
bool SetPosition(float newX, float newY, float newZ, float newOrientation, bool allowPorting=false)
Definition Object.cpp:3354
virtual void sendMessageToSet(WorldPacket *data, bool self, bool myteam_only=false)
Definition Object.cpp:4490
void handleAuraInterruptForMovementFlags(MovementInfo const &movement_info)
Definition Player.cpp:1519
bool m_blinked
Definition Player.hpp:2174
time_t m_fallDisabledUntil
Definition Player.hpp:635
void speedCheatDelay(uint32_t delay)
Definition Player.cpp:9369
void handleBreathing(MovementInfo const &movement_info, WorldSession *session)
Definition Player.cpp:1554
Object * m_summonedObject
Definition Player.hpp:1811
void RemovePassenger(Object *passenger)
void setEmoteState(uint32_t id)
Definition Unit.cpp:1446
uint32_t getEmoteState() const
Definition Unit.cpp:1445
void handleFall(MovementInfo const &movementInfo)
Definition Unit.cpp:2500
uint8_t getStandState() const
Definition Unit.cpp:1365
float m_zAxisPosition
Definition Unit.hpp:612
void removeAllAurasByAuraInterruptFlag(uint32_t auraInterruptFlag, uint32_t skipSpellId=0)
Definition Unit.cpp:5290
bool justDied() const
Definition Unit.cpp:7873
bool isHackDetectedInMovementData(uint16_t opcode)
void updatePlayerMovementVars(uint16_t opcode)
MovementInfo sessionMovementInfo
static const float _minY
static const float _maxY
static const float _maxX
uint8_t transport_seat
ObjectGuid transport_guid
uint32_t transport_time
LocationVector position
void clearTransportData()
bool hasMovementFlag(MovementFlags _flags) const
LocationVector transport_position
void removeMovementFlag(MovementFlags _flags)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMoveNotActiveMoverOpcode()

void WorldSession::handleMoveNotActiveMoverOpcode ( WorldPacket recvPacket)
protected

Definition at line 653 of file MovementHandler.cpp.

654{
655 WoWGuid guid;
656 recvPacket >> guid;
657
658 if (guid == m_MoverWoWGuid)
659 return;
660
661 if (guid != uint64_t(0) && guid == _player->getCharmGuid())
662 m_MoverWoWGuid = guid;
663 else
665}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMoveSplineDoneOpcode()

void WorldSession::handleMoveSplineDoneOpcode ( WorldPacket recvPacket)
protected

Definition at line 236 of file TaxiHandler.cpp.

237{
238 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "WORLD: Received CMSG_MOVE_SPLINE_DONE");
239
240 WoWGuid guid;
241 recvData >> guid;
242
243 MovementInfo movementInfo; // used only for proper packet read
244 movementInfo.readMovementInfo(recvData, recvData.GetOpcode());
245
246 recvData.read_skip<uint32_t>(); // spline id
247
248 uint32_t curDest = GetPlayer()->m_taxi->getTaxiDestination();
249 if (curDest)
250 {
251 WDB::Structures::TaxiNodesEntry const* curDestNode = sTaxiNodesStore.lookupEntry(curDest);
252
253 // far teleport case
254 if (curDestNode && curDestNode->mapid != GetPlayer()->GetMapId() && GetPlayer()->getMovementManager()->getCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
255 {
256 if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(GetPlayer()->getMovementManager()->getCurrentMovementGenerator()))
257 {
258 // short preparations to continue flight
259 flight->setCurrentNodeAfterTeleport();
260 WDB::Structures::TaxiPathNodeEntry const* node = flight->getPath()[flight->getCurrentNode()];
261 flight->skipCurrentNode();
262
263 GetPlayer()->m_taxi->setNodeAfterTeleport(node->NodeIndex);
264 GetPlayer()->safeTeleport(curDestNode->mapid, 0, LocationVector(node->x, node->y, node->z, GetPlayer()->GetOrientation()));
265 }
266 }
267 }
268
269 // at this point only 1 node is expected (final destination)
270 if (GetPlayer()->m_taxi->getPath().size() != 1)
271 return;
272
274}
@ FLIGHT_MOTION_TYPE
SERVER_DECL WDB::WDBContainer< WDB::Structures::TaxiNodesEntry > sTaxiNodesStore
void cleanupAfterTaxiFlight()
Definition Player.cpp:10693
std::unique_ptr< TaxiPath > m_taxi
Definition Player.hpp:1629
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMoveTeleportAckOpcode()

void WorldSession::handleMoveTeleportAckOpcode ( WorldPacket recvPacket)
protected

Definition at line 609 of file MovementHandler.cpp.

610{
611 MsgMoveTeleportAck srlPacket;
612 if (!srlPacket.deserialise(recvPacket))
613 return;
614
615 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_MOVE_TELEPORT_ACK.");
616
617 if (srlPacket.guid.getRawGuid() == _player->getGuid())
618 {
619 if (worldConfig.antiHack.isTeleportHackCheckEnabled && !(HasGMPermissions() && worldConfig.antiHack.isAntiHackCheckDisabledForGm))
620 {
622 {
623 sCheatLog.writefromsession(this, "Used Teleporthack 1, disconnecting.");
624 Disconnect();
625 return;
626 }
627
629 {
630 sCheatLog.writefromsession(this, "Used Teleporthack 2, disconnecting.");
631 Disconnect();
632 return;
633 }
634 }
635
638
639 for (const auto& summon : _player->getSummonInterface()->getSummons())
640 {
641 if (!summon->isTotem())
642 summon->SetPosition(_player->GetPositionX() + 2, _player->GetPositionY() + 2, _player->GetPositionZ(), M_PI_FLOAT);
643 }
644
645 if (_player->m_sentTeleportPosition.x != 999999.0f)
646 {
648 _player->m_sentTeleportPosition.ChangeCoords({ 999999.0f, 999999.0f, 999999.0f });
649 }
650 }
651}
#define M_PI_FLOAT
@ TRANSFER_NONE
void ChangeCoords(const LocationVector &src)
float Distance2DSq(const LocationVector &comp)
LocationVector m_position
Definition Object.hpp:744
void speedCheatReset()
Definition Player.cpp:9374
void setTransferStatus(uint8_t status)
Definition Player.cpp:1889
LocationVector m_sentTeleportPosition
Definition Player.hpp:629
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMoveWorldportAckOpcode()

void WorldSession::handleMoveWorldportAckOpcode ( WorldPacket )
protected

Definition at line 576 of file MovementHandler.cpp.

577{
579 if (_player->IsInWorld())
580 return;
581
582 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_MOVE_WORLDPORT_ACK");
583
585 {
586 const auto transporter = _player->GetTransport();
587
588 const float transportPositionX = transporter->GetPositionX() + _player->GetTransOffsetX();
589 const float transportPositionY = transporter->GetPositionY() + _player->GetTransOffsetY();
590 const float transportPositionZ = transporter->GetPositionZ() + _player->GetTransOffsetZ();
591
592 const auto positionOnTransport = LocationVector(transportPositionX, transportPositionY, transportPositionZ, _player->GetOrientation());
593
594 _player->SetMapId(transporter->GetMapId());
595 _player->SetPosition(transportPositionX, transportPositionY, transportPositionZ, _player->GetOrientation());
596
597 SendPacket(SmsgNewWorld(transporter->GetMapId(), positionOnTransport).serialise().get());
598 }
599 else
600 {
603 }
604
607}
float GetTransOffsetY() const
Definition Object.hpp:382
float GetTransOffsetX() const
Definition Object.hpp:381
float GetTransOffsetZ() const
Definition Object.hpp:383
void SetMapId(uint32_t newMap)
Definition Object.hpp:464
uint32_t m_teleportState
Definition Player.hpp:631
void sendTimeSync()
Definition Player.cpp:10322
void resetTimeSync()
Definition Player.cpp:10314
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMultipleActivateTaxiOpcode()

void WorldSession::handleMultipleActivateTaxiOpcode ( WorldPacket recvPacket)
protected

Definition at line 203 of file TaxiHandler.cpp.

204{
205 CmsgActivateTaxiExpress srlPacket;
206 if (!srlPacket.deserialise(recvPacket))
207 return;
208
209 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_ACTIVATE_TAXI_EXPRESS");
210
212 if (!npc)
213 {
215 return;
216 }
217 std::vector<uint32_t> nodes;
218
219 for (uint32_t i = 0; i < srlPacket.nodeCount; ++i)
220 {
221 if (!GetPlayer()->m_taxi->isTaximaskNodeKnown(srlPacket.pathParts[i]) && !GetPlayer()->m_cheats.hasTaxiCheat)
222 {
224 return;
225 }
226
227 nodes.push_back(srlPacket.pathParts[i]);
228 }
229
230 if (nodes.empty())
231 return;
232
233 GetPlayer()->activateTaxiPathTo(nodes, npc);
234}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleNameQueryOpcode()

void WorldSession::handleNameQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 32 of file QueryHandler.cpp.

33{
34 CmsgNameQuery srlPacket;
35 if (!srlPacket.deserialise(recvData))
36 {
37 Disconnect();
38 return;
39 }
40
41 const auto info = sObjectMgr.getCachedCharacterInfo(srlPacket.guid.getGuidLow());
42 if (!info)
43 return;
44
45 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_NAME_QUERY for: {}", info->name);
46 SendPacket(SmsgQueryPlayernameResponse(srlPacket.guid, info->name, info->race, info->gender, info->cl).serialise().get());
47}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleNextCinematic()

void WorldSession::handleNextCinematic ( WorldPacket )
protected

Definition at line 1067 of file MiscHandler.cpp.

1068{
1069 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_NEXT_CINEMATIC_CAMERA");
1070
1071 _player->SetPosition(float(_player->GetPositionX() + 0.01), float(_player->GetPositionY() + 0.01),
1072 float(_player->GetPositionZ() + 0.01), _player->GetOrientation());
1073}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleNpcTextQueryOpcode()

void WorldSession::handleNpcTextQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 604 of file NPCHandler.cpp.

605{
606 CmsgNpcTextQuery srlPacket;
607 if (!srlPacket.deserialise(recvPacket))
608 return;
609
610 sLogger.debug("Received: CMSG_NPC_TEXT_QUERY: {} (textId)", srlPacket.text_id);
611
612 _player->setTargetGuid(srlPacket.guid);
613
614 const auto localesNpcText = (language > 0) ? sMySQLStore.getLocalizedNpcGossipText(srlPacket.text_id, language) : nullptr;
615
616 WorldPacket data;
618 data << srlPacket.text_id;
619
620 if (const auto pGossip = sMySQLStore.getNpcGossipText(srlPacket.text_id))
621 {
622 for (uint8_t i = 0; i < 8; ++i)
623 {
624 data << float(pGossip->textHolder[i].probability);
625
626 if (localesNpcText)
627 {
628 if (strlen(localesNpcText->texts[i][0]) == 0)
629 data << localesNpcText->texts[i][1];
630 else
631 data << localesNpcText->texts[i][0];
632
633 if (strlen(localesNpcText->texts[i][1]) == 0)
634 data << localesNpcText->texts[i][0];
635 else
636 data << localesNpcText->texts[i][1];
637 }
638 else
639 {
640 if (pGossip->textHolder[i].texts[0].empty())
641 data << pGossip->textHolder[i].texts[1];
642 else
643 data << pGossip->textHolder[i].texts[0];
644
645 if (pGossip->textHolder[i].texts[1].empty())
646 data << pGossip->textHolder[i].texts[0];
647 else
648 data << pGossip->textHolder[i].texts[1];
649 }
650
651 data << pGossip->textHolder[i].language;
652
653 for (uint8_t e = 0; e < GOSSIP_EMOTE_COUNT; ++e)
654 {
655 data << uint32_t(pGossip->textHolder[i].gossipEmotes[e].delay);
656 data << uint32_t(pGossip->textHolder[i].gossipEmotes[e].emote);
657 }
658 }
659 }
660 else
661 {
662 for (uint8_t i = 0; i < 8; ++i)
663 {
664 data << float(1.0f); // Prob
667 data << uint32_t(0x00); // Language
668
669 for (uint8_t e = 0; e < GOSSIP_EMOTE_COUNT; e++)
670 {
671 data << uint32_t(0x00); // Emote delay
672 data << uint32_t(0x00); // Emote
673 }
674 }
675 }
676
677 SendPacket(&data);
678}
#define GOSSIP_EMOTE_COUNT
@ SMSG_NPC_TEXT_UPDATE
Definition Opcodes.hpp:429
@ SS_HEY_HOW_CAN_I_HELP_YOU
void Initialize(uint16_t opcode, size_t newres=200)
Definition WorldPacket.h:20
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleObjectUpdateFailedOpcode()

void WorldSession::handleObjectUpdateFailedOpcode ( WorldPacket recvPacket)
protected

Definition at line 1206 of file MiscHandler.cpp.

1207{
1208#if VERSION_STRING >= Cata
1209 ObjectGuid guid;
1210
1211#if VERSION_STRING == Cata
1212 guid[6] = recvPacket.readBit();
1213 guid[7] = recvPacket.readBit();
1214 guid[4] = recvPacket.readBit();
1215 guid[0] = recvPacket.readBit();
1216 guid[1] = recvPacket.readBit();
1217 guid[5] = recvPacket.readBit();
1218 guid[3] = recvPacket.readBit();
1219 guid[2] = recvPacket.readBit();
1220
1221 recvPacket.ReadByteSeq(guid[6]);
1222 recvPacket.ReadByteSeq(guid[7]);
1223 recvPacket.ReadByteSeq(guid[2]);
1224 recvPacket.ReadByteSeq(guid[3]);
1225 recvPacket.ReadByteSeq(guid[1]);
1226 recvPacket.ReadByteSeq(guid[4]);
1227 recvPacket.ReadByteSeq(guid[0]);
1228 recvPacket.ReadByteSeq(guid[5]);
1229#elif VERSION_STRING == Mop
1230 guid[3] = recvPacket.readBit();
1231 guid[5] = recvPacket.readBit();
1232 guid[6] = recvPacket.readBit();
1233 guid[0] = recvPacket.readBit();
1234 guid[1] = recvPacket.readBit();
1235 guid[2] = recvPacket.readBit();
1236 guid[7] = recvPacket.readBit();
1237 guid[4] = recvPacket.readBit();
1238
1239 recvPacket.ReadByteSeq(guid[0]);
1240 recvPacket.ReadByteSeq(guid[6]);
1241 recvPacket.ReadByteSeq(guid[5]);
1242 recvPacket.ReadByteSeq(guid[7]);
1243 recvPacket.ReadByteSeq(guid[2]);
1244 recvPacket.ReadByteSeq(guid[1]);
1245 recvPacket.ReadByteSeq(guid[3]);
1246 recvPacket.ReadByteSeq(guid[4]);
1247#endif
1248
1249 sLogger.failure("handleObjectUpdateFailedOpcode : Object update failed for playerguid {}", WoWGuid::getGuidLowPartFromUInt64(guid));
1250
1251 if (_player == nullptr)
1252 return;
1253
1254 if (_player->getGuid() == guid)
1255 {
1256 LogoutPlayer(true);
1257 return;
1258 }
1259
1260 //_player->updateVisibility();
1261#endif
1262}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleOpenItemOpcode()

void WorldSession::handleOpenItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 626 of file MiscHandler.cpp.

627{
628 CmsgOpenItem srlPacket;
629 if (!srlPacket.deserialise(recvPacket))
630 return;
631
632 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_OPEN_ITEM: {} (containerSlot), {} (slot)", srlPacket.containerSlot, srlPacket.slot);
633
634 auto item = _player->getItemInterface()->GetInventoryItem(srlPacket.containerSlot, srlPacket.slot);
635 if (item == nullptr)
636 return;
637
638 if (item->getGiftCreatorGuid() && item->m_wrappedItemId)
639 {
640 const auto wrappedItem = sMySQLStore.getItemProperties(item->m_wrappedItemId);
641 if (wrappedItem == nullptr)
642 return;
643
644 item->setGiftCreatorGuid(0);
645 item->setEntry(item->m_wrappedItemId);
646 item->m_wrappedItemId = 0;
647 item->setItemProperties(wrappedItem);
648
649 if (wrappedItem->Bonding == ITEM_BIND_ON_PICKUP)
650 item->addFlags(ITEM_FLAG_SOULBOUND);
651 else
652 item->setFlags(ITEM_FLAGS_NONE);
653
654 if (wrappedItem->MaxDurability)
655 {
656 item->setDurability(wrappedItem->MaxDurability);
657 item->setMaxDurability(wrappedItem->MaxDurability);
658 }
659
660 item->m_isDirty = true;
661 item->saveToDB(srlPacket.containerSlot, srlPacket.slot, false, nullptr);
662 return;
663 }
664
665 uint32_t removeLockItems[LOCK_NUM_CASES] = { 0, 0, 0, 0, 0, 0, 0, 0 };
666 const auto lockEntry = sLockStore.lookupEntry(item->getItemProperties()->LockId);
667 if (lockEntry)
668 {
669 for (uint8_t lockCase = 0; lockCase < LOCK_NUM_CASES; ++lockCase)
670 {
671 if (lockEntry->locktype[lockCase] == 1 && lockEntry->lockmisc[lockCase] > 0)
672 {
673 const int16_t slot2 = _player->getItemInterface()->GetInventorySlotById(lockEntry->lockmisc[lockCase]);
675 {
676 removeLockItems[lockCase] = lockEntry->lockmisc[lockCase];
677 }
678 else
679 {
681 return;
682 }
683 }
684 else if (lockEntry->locktype[lockCase] == 2 && item->m_isLocked)
685 {
687 return;
688 }
689 }
690
691 for (uint8_t lockCase = 0; lockCase < LOCK_NUM_CASES; ++lockCase)
692 {
693 if (removeLockItems[lockCase])
694 _player->getItemInterface()->RemoveItemAmt(removeLockItems[lockCase], 1);
695 }
696 }
697
698 _player->setLootGuid(item->getGuid());
699 if (item->m_loot == nullptr)
700 {
701 item->m_loot = std::make_unique<Loot>();
702 sLootMgr.fillItemLoot(_player, item->m_loot.get(), item->getEntry(), 0);
703 }
704 _player->sendLoot(item->getGuid(), LOOT_DISENCHANTING, _player->GetMapId());
705}
@ ITEM_FLAGS_NONE
@ ITEM_BIND_ON_PICKUP
@ INV_ERR_ITEM_LOCKED
@ LOOT_DISENCHANTING
SERVER_DECL WDB::WDBContainer< WDB::Structures::LockEntry > sLockStore
Definition WDBStores.cpp:89
#define LOCK_NUM_CASES
int16_t GetInventorySlotById(uint32_t ID)
Gets slot number by itemid, banks not included.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePageTextQueryOpcode()

void WorldSession::handlePageTextQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 144 of file QueryHandler.cpp.

145{
146 CmsgPageTextQuery srlPacket;
147 if (!srlPacket.deserialise(recvPacket))
148 return;
149
150 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_PAGE_TEXT_QUERY: {} (pageId)", srlPacket.pageId);
151
152 uint32_t pageId = srlPacket.pageId;
153 while (pageId)
154 {
155 const auto itemPage = sMySQLStore.getItemPage(pageId);
156 if (itemPage == nullptr)
157 return;
158
159 const auto localizedPage = language > 0 ? sMySQLStore.getLocalizedItemPages(pageId, language) : nullptr;
160 const auto pageText = localizedPage ? localizedPage->text : itemPage->text.c_str();
161
162 SendPacket(SmsgPageTextQueryResponse(pageId, pageText, itemPage->nextPage).serialise().get());
163
164 pageId = itemPage->nextPage;
165 }
166}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePartyMemberStatsOpcode()

void WorldSession::handlePartyMemberStatsOpcode ( WorldPacket recvPacket)
private

Definition at line 739 of file GroupHandler.cpp.

740{
742 if (!srlPacket.deserialise(recvPacket))
743 return;
744
745 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REQUEST_PARTY_MEMBER_STATS: {} (guidLow)", srlPacket.guid.getGuidLow());
746
747 if (_player->getWorldMap() == nullptr)
748 {
749 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REQUEST_PARTY_MEMBER_STATS: But MapMgr is not ready!");
750 return;
751 }
752
753 const auto requestedPlayer = _player->getWorldMap()->getPlayer(srlPacket.guid.getGuidLow());
754 if (_player->getGroup() == nullptr || requestedPlayer == nullptr)
755 {
756 SendPacket(SmsgPartyMemberStatsFull(srlPacket.guid, nullptr).serialise().get());
757 return;
758 }
759
760 if (!_player->getGroup()->HasMember(requestedPlayer))
761 return;
762
763 if (_player->isVisibleObject(requestedPlayer->getGuid()))
764 return;
765
766 SendPacket(SmsgPartyMemberStatsFull(requestedPlayer->getGuid(), requestedPlayer).serialise().get());
767}
bool HasMember(Player *pPlayer)
Definition Group.cpp:605
bool isVisibleObject(uint64_t guid)
Definition Player.cpp:3599
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePetAbandon()

void WorldSession::handlePetAbandon ( WorldPacket )
protected

Definition at line 501 of file PetHandler.cpp.

502{
503 const auto pet = _player->getPet();
504 if (pet == nullptr)
505 return;
506
507 pet->abandonPet();
508}
void abandonPet()
Definition Pet.cpp:405
Pet * getPet() const
Definition Unit.cpp:7929
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePetAction()

void WorldSession::handlePetAction ( WorldPacket recvPacket)
protected

Definition at line 44 of file PetHandler.cpp.

45{
46 CmsgPetAction srlPacket;
47 if (!srlPacket.deserialise(recvPacket))
48 return;
49
50 if (srlPacket.guid.isUnit())
51 {
52 const auto creature = _player->getWorldMapCreature(srlPacket.guid.getGuidLowPart());
53 if (creature == nullptr)
54 return;
55
57 {
58 switch (srlPacket.buttonData.parts.spellId)
59 {
61 {
63 {
64 uint32_t timer = creature->getBaseAttackTime(MELEE);
65 if (timer == 0)
66 timer = 2000;
67
70 }
71 } break;
72 default:
73 break;
74 }
75 }
76 return;
77 }
78
79 const auto pet = _player->getWorldMapPet(srlPacket.guid.getGuidLowPart());
80 if (pet == nullptr)
81 return;
82
83 Unit* unitTarget = nullptr;
85 {
86 unitTarget = _player->getWorldMapUnit(srlPacket.targetguid);
87 if (unitTarget == nullptr)
88 unitTarget = pet;
89 }
90
91 // Intentionally create a copy of guardians to avoid invalid iterators later
92 const std::vector<Summon*> summons = _player->getSummonInterface()->getSummons();
93 bool alive_summon = false;
94 for (auto itr = summons.cbegin(); itr != summons.cend();)
95 {
96 const auto guardian = (*itr);
97 ++itr;
98
99 if (!guardian->isPet())
100 continue;
101
102 const auto summonedPet = dynamic_cast<Pet*>(guardian);
103 if (summonedPet == nullptr)
104 continue;
105
106 if (!summonedPet->isAlive())
107 continue;
108
109 alive_summon = true;
110 const uint64_t summonedPetGuid = summonedPet->getGuid();
111 switch (srlPacket.buttonData.parts.state)
112 {
114 {
115 summonedPet->setPetAction(static_cast<PetCommands>(srlPacket.buttonData.parts.spellId));
116 switch (srlPacket.buttonData.parts.spellId)
117 {
119 {
120 if (!summonedPet->getAIInterface()->canOwnerAttackUnit(unitTarget))
121 {
122 summonedPet->sendActionFeedback(PET_FEEDBACK_CANT_ATTACK_TARGET);
123 return;
124 }
125
126 summonedPet->getAIInterface()->setPetOwner(_player);
127 summonedPet->getMovementManager()->remove(FOLLOW_MOTION_TYPE);
128 summonedPet->getAIInterface()->attackStartUnsafe(unitTarget);
129 }
130 break;
132 {
133 summonedPet->getAIInterface()->enterEvadeMode();
134 }
135 break;
136 case PET_ACTION_STAY:
137 {
138 summonedPet->getMovementManager()->remove(FOLLOW_MOTION_TYPE);
139 }
140 break;
142 {
143 summonedPet->abandonPet();
144 }
145 break;
146 }
147 }
148 break;
149
153 {
154 const auto spellInfo = sSpellMgr.getSpellInfo(srlPacket.buttonData.parts.spellId);
155 if (spellInfo == nullptr || spellInfo->isPassive())
156 return;
157
158 if (!summonedPet->hasSpell(spellInfo->getId()))
159 return;
160
161 // If spell is autocasted check cooldown from ai spell data
162 // TODO: pet cooldowns are not saved for non autocasted spells!
163 auto* const aiSpell = summonedPet->getAIInterface()->getAISpell(spellInfo->getId());
164 if (aiSpell != nullptr)
165 {
166 if (!aiSpell->mCooldownTimer->isTimePassed())
167 {
168 summonedPet->sendPetCastFailed(srlPacket.buttonData.parts.spellId, SPELL_FAILED_NOT_READY);
169 return;
170 }
171 }
172
173 // Check target for hostile spells
174 const auto spellTargetMask = spellInfo->getRequiredTargetMask(true);
175 if (spellTargetMask & SPELL_TARGET_REQUIRE_ATTACKABLE && !(spellTargetMask & SPELL_TARGET_REQUIRE_FRIENDLY))
176 {
177 if (!summonedPet->getAIInterface()->canOwnerAttackUnit(unitTarget))
178 {
179 summonedPet->sendActionFeedback(PET_FEEDBACK_CANT_ATTACK_TARGET);
180 return;
181 }
182 }
183
185 if (aiSpell != nullptr)
186 {
187 // TODO: target cannot be changed?
188 castResult = summonedPet->getAIInterface()->castAISpell(aiSpell);
189 }
190 else
191 {
192 castResult = summonedPet->castSpell(unitTarget, spellInfo);
193 }
194
195 if (castResult != SPELL_CAST_SUCCESS)
196 {
197 summonedPet->sendPetCastFailed(spellInfo->getId(), castResult);
198 return;
199 }
200
201 if (spellTargetMask & SPELL_TARGET_REQUIRE_ATTACKABLE && !(spellTargetMask & SPELL_TARGET_REQUIRE_FRIENDLY))
202 {
203 summonedPet->getAIInterface()->onHostileAction(unitTarget, nullptr, true);
204 }
205 }
206 break;
208 {
209 // If set to passive pet should stop attacking and return to owner
210 if (srlPacket.buttonData.parts.spellId == REACT_PASSIVE)
211 summonedPet->getAIInterface()->enterEvadeMode();
212
213 summonedPet->getAIInterface()->setReactState(ReactStates(srlPacket.buttonData.parts.spellId));
214
215 }
216 break;
217 default:
218 sLogger.debug("WARNING: Unknown pet action received. State = {}, Spell = {}", static_cast<uint32_t>(srlPacket.buttonData.parts.state), static_cast<uint32_t>(srlPacket.buttonData.parts.spellId));
219 break;
220 }
221
222 SendPacket(SmsgPetActionSound(summonedPetGuid, 1).serialise().get());
223 }
224
225 if (!alive_summon)
226 pet->sendActionFeedback(PET_FEEDBACK_PET_DEAD);
227}
ReactStates
Definition AIInterface.h:78
@ REACT_PASSIVE
Definition AIInterface.h:79
@ EVENT_PLAYER_CHARM_ATTACK
Definition EventMgr.h:52
@ FOLLOW_MOTION_TYPE
PetCommands
@ PET_ACTION_ATTACK
@ PET_ACTION_STAY
@ PET_ACTION_FOLLOW
@ PET_ACTION_DISMISS
@ PET_SPELL_STATE_DEFAULT
@ PET_SPELL_STATE_AUTOCAST
@ PET_SPELL_STATE_PASSIVE
@ PET_SPELL_STATE_SET_ACTION
@ PET_SPELL_STATE_SET_REACT
@ PET_FEEDBACK_PET_DEAD
@ PET_FEEDBACK_CANT_ATTACK_TARGET
SpellCastResult
@ SPELL_FAILED_ERROR
@ SPELL_FAILED_NOT_READY
@ SPELL_TARGET_REQUIRE_ATTACKABLE
Definition SpellTarget.h:28
@ SPELL_TARGET_REQUIRE_FRIENDLY
Definition SpellTarget.h:29
@ MELEE
PetActionButtonData buttonData
Creature * getWorldMapCreature(const uint64_t &guid) const
Definition Object.cpp:4597
Pet * getWorldMapPet(const uint64_t &guid) const
Definition Object.cpp:4567
Definition Pet.h:44
void eventCharmAttack()
Definition Player.cpp:13699
std::vector< Summon * > const & getSummons() const
uint32_t getBaseAttackTime(uint8_t slot) const
Definition Unit.cpp:1233
struct PetActionButtonData::Parts parts
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePetCancelAura()

void WorldSession::handlePetCancelAura ( WorldPacket recvPacket)
protected

Definition at line 557 of file PetHandler.cpp.

558{
559 CmsgPetCancelAura srlPacket;
560 if (!srlPacket.deserialise(recvPacket))
561 return;
562
563 const auto spellInfo = sSpellMgr.getSpellInfo(srlPacket.spellId);
564 if (spellInfo != nullptr && spellInfo->getAttributes() & static_cast<uint32_t>(ATTRIBUTES_CANT_CANCEL))
565 return;
566
567 const auto creature = _player->getWorldMapCreature(srlPacket.guid.getGuidLow());
568#ifdef FT_VEHICLES
569 if (creature != nullptr && (creature->getPlayerOwner() == _player || _player->getVehicleKit() && _player->getVehicleKit()->isControler(_player)))
570 creature->removeAllAurasById(srlPacket.spellId);
571#else
572 if (creature != nullptr && (creature->getPlayerOwner() == _player))
573 creature->removeAllAurasById(srlPacket.spellId);
574#endif
575}
void removeAllAurasById(uint32_t auraId, AuraRemoveMode mode=AURA_REMOVE_BY_SERVER)
Definition Unit.cpp:5248
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePetCastSpell()

void WorldSession::handlePetCastSpell ( WorldPacket recvPacket)
protected

Definition at line 240 of file SpellHandler.cpp.

241{
242 CmsgPetCastSpell srlPacket;
243 if (!srlPacket.deserialise(recvPacket))
244 return;
245
246 const auto spellInfo = sSpellMgr.getSpellInfo(srlPacket.spellId);
247 if (spellInfo == nullptr)
248 return;
249
250 if (_player->getPet() == nullptr && _player->getCharmGuid() == 0)
251 {
252 sLogger.failure("Received opcode but player {} has no pet.", _player->getGuidLow());
253 return;
254 }
255
256 Unit* petUnit = _player->getWorldMap()->getUnit(srlPacket.petGuid);
257 if (petUnit == nullptr)
258 {
259 sLogger.failure("Pet entity cannot be found for player {}.", _player->getGuidLow());
260 return;
261 }
262
263 if (spellInfo->isPassive())
264 return;
265
266 // If pet is summoned by player
267 if (_player->getPet() == petUnit)
268 {
269 // Check does the pet have the spell
270 if (!dynamic_cast<Pet*>(petUnit)->hasSpell(srlPacket.spellId))
271 return;
272 }
273 // If pet is charmed or possessed by player
274 else if (_player->getCharmGuid() == srlPacket.petGuid)
275 {
276 bool found = false;
277 for (const auto& aiSpell : petUnit->getAIInterface()->m_spells)
278 {
279 if (aiSpell->spell->getId() == srlPacket.spellId)
280 {
281 found = true;
282 break;
283 }
284 }
285
286 if (!found && petUnit->isCreature())
287 {
288 Creature* petCreature = dynamic_cast<Creature*>(petUnit);
289 if (petCreature->GetCreatureProperties()->spelldataid != 0)
290 {
291 if (const auto creatureSpellData = sCreatureSpellDataStore.lookupEntry(petCreature->GetCreatureProperties()->spelldataid))
292 {
293 for (uint8_t i = 0; i < 3; ++i)
294 {
295 if (creatureSpellData->Spells[i] == srlPacket.spellId)
296 {
297 found = true;
298 break;
299 }
300 }
301 }
302 }
303
304 if (!found)
305 {
306 for (uint8_t i = 0; i < 4; ++i)
307 {
308 if (petCreature->GetCreatureProperties()->AISpells[i] == srlPacket.spellId)
309 {
310 found = true;
311 break;
312 }
313 }
314 }
315 }
316
317 if (!found)
318 return;
319 }
320 else
321 {
322 sLogger.failure("Pet doesn't belong to player {}", _player->getGuidLow());
323 return;
324 }
325
326 SpellCastTargets targets(recvPacket, srlPacket.petGuid);
327 Spell* spell = sSpellMgr.newSpell(petUnit, spellInfo, false, nullptr);
328 spell->extra_cast_number = srlPacket.castCount;
329
330 // Some spell cast packets include more data
331 if (srlPacket.castFlags & 0x02)
332 {
333 float projectilePitch, projectileSpeed;
334 uint8_t hasMovementData; // 1 or 0
335 recvPacket >> projectilePitch >> projectileSpeed >> hasMovementData;
336
337 LocationVector const spellDestination = targets.getDestination();
338 LocationVector const spellSource = targets.getSource();
339 float const deltaX = spellDestination.x - spellSource.x; // Calculate change of x position
340 float const deltaY = spellDestination.y - spellSource.y; // Calculate change of y position
341
342 uint32_t travelTime = 0;
343 if ((projectilePitch != M_PI / 4) && (projectilePitch != -M_PI / 4)) // No division by zero
344 {
345 // Calculate projectile's travel time by using Pythagorean theorem to get distance from delta X and delta Y, and divide that with the projectile's velocity
346 travelTime = static_cast<uint32_t>((sqrtf(deltaX * deltaX + deltaY * deltaY) / (cosf(projectilePitch) * projectileSpeed)) * 1000);
347 }
348
349 if (hasMovementData)
350 {
351 recvPacket.SetOpcode(recvPacket.read<uint16_t>()); // MSG_MOVE_STOP
352 handleMovementOpcodes(recvPacket);
353 }
354
355 spell->m_missilePitch = projectilePitch;
356 spell->m_missileTravelTime = travelTime;
357 }
358
359 spell->prepare(&targets);
360}
SERVER_DECL WDB::WDBContainer< WDB::Structures::CreatureSpellDataEntry > sCreatureSpellDataStore
Definition WDBStores.cpp:71
uint32_t AISpells[creatureMaxProtoSpells]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePetLearnTalent()

void WorldSession::handlePetLearnTalent ( WorldPacket recvPacket)
protected

Definition at line 577 of file PetHandler.cpp.

578{
579#if VERSION_STRING < Cata
580#if VERSION_STRING > TBC
581 CmsgPetLearnTalent srlPacket;
582 if (!srlPacket.deserialise(recvPacket))
583 return;
584
585 const auto pet = _player->getPet();
586 if (pet == nullptr)
587 return;
588
589 if (pet->getPetTalentPoints() < 1)
590 return;
591
592 const auto talent = sTalentStore.lookupEntry(srlPacket.talentId);
593 if (talent == nullptr)
594 return;
595
596 if (talent->DependsOn > 0)
597 {
598 const auto depends_talent = sTalentStore.lookupEntry(talent->DependsOn);
599 if (depends_talent == nullptr)
600 return;
601
602 bool req_ok = false;
603 for (unsigned int i : depends_talent->RankID)
604 {
605 if (i != 0)
606 {
607 if (pet->hasSpell(i))
608 {
609 req_ok = true;
610 break;
611 }
612 }
613 }
614 if (!req_ok)
615 return;
616 }
617
618 if (pet->getSpentTalentPoints() < (talent->Row * 3))
619 return;
620
621 const auto spellInfo = sSpellMgr.getSpellInfo(talent->RankID[srlPacket.talentCol]);
622 if (spellInfo != nullptr)
623 {
624 pet->addSpell(spellInfo);
625 pet->setPetTalentPoints(pet->getPetTalentPoints() - 1);
626 }
627
628 pet->SendTalentsToOwner();
629
630#endif
631#else
632
633#if VERSION_STRING < Mop
634 CmsgPetLearnTalent srlPacket;
635 if (!srlPacket.deserialise(recvPacket))
636 return;
637
638 const auto pet = _player->getPet();
639 if (pet == nullptr)
640 return;
641
642 if (srlPacket.guid != pet->getGuid())
643 return;
644
645 if (pet->getPetTalentPoints() < 1)
646 return;
647
648 const auto talentEntry = sTalentStore.lookupEntry(srlPacket.talentId);
649 if (talentEntry == nullptr)
650 return;
651
652 if (talentEntry->DependsOn > 0)
653 {
654 WDB::Structures::TalentEntry const* depends_talent = sTalentStore.lookupEntry(talentEntry->DependsOn);
655 if (depends_talent == nullptr)
656 return;
657
658 bool req_ok = false;
659 for (unsigned int i : depends_talent->RankID)
660 {
661 if (i != 0)
662 {
663 if (pet->hasSpell(i))
664 {
665 req_ok = true;
666 break;
667 }
668 }
669 }
670 if (!req_ok)
671 return;
672 }
673
674 if (pet->getSpentTalentPoints() < (talentEntry->Row * 3))
675 return;
676
677 const auto spellInfo = sSpellMgr.getSpellInfo(talentEntry->RankID[srlPacket.talentCol]);
678 if (spellInfo != nullptr)
679 {
680 pet->addSpell(spellInfo);
681 pet->setPetTalentPoints(pet->getPetTalentPoints() - 1);
682 }
683
684 pet->SendTalentsToOwner();
685#endif
686#endif
687}
void addSpell(SpellInfo const *spellInfo, bool silently=false)
Definition Pet.cpp:1008
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePetNameQuery()

void WorldSession::handlePetNameQuery ( WorldPacket recvPacket)
protected

Definition at line 229 of file PetHandler.cpp.

230{
231 CmsgPetNameQuery srlPacket;
232 if (!srlPacket.deserialise(recvPacket))
233 return;
234
235 const auto pet = _player->getWorldMapPet(srlPacket.guid.getGuidLowPart());
236 if (pet == nullptr)
237 return;
238
239 SendPacket(SmsgPetNameQuery(srlPacket.petNumber, pet->getName(), pet->getPetNameTimestamp(), 0).serialise().get());
240}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePetRename()

void WorldSession::handlePetRename ( WorldPacket recvPacket)
protected

Definition at line 461 of file PetHandler.cpp.

462{
463 CmsgPetRename srlPacket;
464 if (!srlPacket.deserialise(recvPacket))
465 return;
466
467 const auto pet = _player->getPet();
468 if (pet == nullptr || pet->getGuid() != srlPacket.guid.getRawGuid())
469 return;
470
471 const std::string newName = CharacterDatabase.EscapeString(srlPacket.name);
472
473 pet->rename(newName);
474
475 pet->setSheathType(SHEATH_STATE_MELEE);
476#if VERSION_STRING == Classic
477 pet->removeUnitFlags(UNIT_FLAG_PET_CAN_BE_RENAMED);
478#else
479 pet->removePetFlags(PET_FLAG_CAN_BE_RENAMED);
480#endif
481
482 if (pet->getPlayerOwner() != nullptr)
483 {
484 if (pet->getPlayerOwner()->isPvpFlagSet())
485 pet->setPvpFlag();
486 else
487 pet->removePvpFlag();
488
489 if (pet->getPlayerOwner()->isFfaPvpFlagSet())
490 pet->setFfaPvpFlag();
491 else
492 pet->removeFfaPvpFlag();
493
494 if (pet->getPlayerOwner()->isSanctuaryFlagSet())
495 pet->setSanctuaryFlag();
496 else
497 pet->removeSanctuaryFlag();
498 }
499}
@ SHEATH_STATE_MELEE
@ UNIT_FLAG_PET_CAN_BE_RENAMED
@ PET_FLAG_CAN_BE_RENAMED
void rename(utf8_string const &newName)
Definition Pet.cpp:461
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePetSetActionOpcode()

void WorldSession::handlePetSetActionOpcode ( WorldPacket recvPacket)
protected

Definition at line 411 of file PetHandler.cpp.

412{
413 CmsgPetSetAction srlPacket;
414 if (!srlPacket.deserialise(recvPacket))
415 return;
416
417 if (srlPacket.srcSlot >= PET_MAX_ACTION_BAR_SLOT || srlPacket.dstSlot >= PET_MAX_ACTION_BAR_SLOT)
418 return;
419
420 auto* const pet = _player->getPet();
421 if (pet == nullptr)
422 return;
423
424 // Prevent removing action or react button from bar
425 if (srlPacket.srcButton.parts.state & PET_SPELL_STATE_NOT_SPELL && srlPacket.dstButton.raw == 0)
426 return;
427
428 const auto handleButton = [pet](uint32_t slot, PetActionButtonData const& button) -> void
429 {
430 if (button.parts.state == PET_SPELL_STATE_PASSIVE || button.parts.state == PET_SPELL_STATE_DEFAULT || button.parts.state == PET_SPELL_STATE_AUTOCAST)
431 {
432 if (button.parts.spellId == 0)
433 {
434 // Emptied a slot
435 pet->setActionBarSlot(slot, 0, 0);
436 return;
437 }
438
439 if (!pet->hasSpell(button.parts.spellId))
440 return;
441
442 // Updates actionbar as well
443 pet->setSpellState(button.parts.spellId, button.parts.state, slot);
444 }
445 else
446 {
447 // Client seems to send sometimes weird data or packet structure is still not correct
448 if (button.parts.state != PET_SPELL_STATE_SET_REACT && button.parts.state != PET_SPELL_STATE_SET_ACTION)
449 pet->setActionBarSlot(slot, 0, 0);
450 else
451 pet->setActionBarSlot(slot, button.parts.spellId, button.parts.state);
452 }
453 };
454
455 handleButton(srlPacket.srcSlot, srlPacket.srcButton);
456 // Handle swap case
457 if (srlPacket.dstButton.raw != 0)
458 handleButton(srlPacket.dstSlot, srlPacket.dstButton);
459}
static constexpr uint8_t PET_MAX_ACTION_BAR_SLOT
@ PET_SPELL_STATE_NOT_SPELL
void setActionBarSlot(uint8_t slot, uint32_t spellId, uint8_t state)
Definition Pet.cpp:1129
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePetSpellAutocast()

void WorldSession::handlePetSpellAutocast ( WorldPacket recvPacket)
protected

Definition at line 537 of file PetHandler.cpp.

538{
539 CmsgPetSpellAutocast srlPacket;
540 if (!srlPacket.deserialise(recvPacket))
541 return;
542
543 const auto pet = _player->getPet();
544 if (pet == nullptr)
545 return;
546
547 const auto spellInfo = sSpellMgr.getSpellInfo(srlPacket.spellId);
548 if (spellInfo == nullptr)
549 return;
550
551 if (!pet->hasSpell(spellInfo->getId()))
552 return;
553
555}
void setSpellState(uint32_t spellId, uint8_t state, std::optional< uint32_t > actionSlotId=std::nullopt)
Definition Pet.cpp:1099
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePetUnlearn()

void WorldSession::handlePetUnlearn ( WorldPacket recvPacket)
protected

Definition at line 510 of file PetHandler.cpp.

511{
512 CmsgPetUnlearn srlPacket;
513 if (!srlPacket.deserialise(recvPacket))
514 return;
515
516 const auto pet = _player->getPet();
517 if (pet == nullptr || pet->getGuid() != srlPacket.guid.getRawGuid())
518 return;
519
520#if VERSION_STRING < Mop
521 const uint32_t untrainCost = pet->getUntrainCost();
522 if (!_player->hasEnoughCoinage(untrainCost))
523 {
524 sendBuyFailed(_player->getGuid(), 0, 2);
525 return;
526 }
527 _player->modCoinage(-static_cast<int32_t>(untrainCost));
528#endif
529
530 pet->WipeTalents();
531#if VERSION_STRING == WotLK || VERSION_STRING == Cata
532 pet->setPetTalentPoints(pet->getTotalTalentPoints());
533 pet->SendTalentsToOwner();
534#endif
535}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePlayedTimeOpcode()

void WorldSession::handlePlayedTimeOpcode ( WorldPacket recvPacket)
protected

Definition at line 344 of file MiscHandler.cpp.

345{
346 CmsgRequestPlayedTime srlPacket;
347 if (!srlPacket.deserialise(recvPacket))
348 return;
349
350 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REQUEST_PLAYED_TIME: displayInChatFrame: {}", srlPacket.displayInChatFrame);
351
352 const uint32_t playedTime = static_cast<uint32_t>(UNIXTIME) - _player->m_playedTime[2];
353 if (playedTime > 0)
354 {
355 _player->m_playedTime[0] += playedTime;
356 _player->m_playedTime[1] += playedTime;
357 _player->m_playedTime[2] += playedTime;
358 }
359
361
362 sLogger.debug("Sent SMSG_PLAYED_TIME total: {} level: {}", _player->m_playedTime[1], _player->m_playedTime[0]);
363}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePlayerLoginOpcode()

void WorldSession::handlePlayerLoginOpcode ( WorldPacket recvPacket)
protected

Definition at line 191 of file CharacterHandler.cpp.

192{
193 CmsgPlayerLogin srlPacket;
194 if (!srlPacket.deserialise(recvPacket))
195 return;
196
197 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_PLAYER_LOGIN {} (guidLow)", srlPacket.guid.getGuidLow());
198
199 if (sObjectMgr.getPlayer(srlPacket.guid.getGuidLow()) != nullptr || m_loggingInPlayer || _player)
200 {
202 return;
203 }
204
205 auto query = std::make_unique<AsyncQuery>(std::make_unique<SQLClassCallbackP0<WorldSession>>(this, &WorldSession::loadPlayerFromDBProc));
206 query->AddQuery("SELECT guid,class FROM characters WHERE guid = %u AND login_flags = %u",
207 srlPacket.guid.getGuidLow(), static_cast<uint32_t>(LOGIN_NO_FLAG));
208 CharacterDatabase.QueueAsyncQuery(std::move(query));
209}
@ E_CHAR_LOGIN_DUPLICATE_CHARACTER
void loadPlayerFromDBProc(QueryResultVector &results)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePlayerLogoutOpcode()

void WorldSession::handlePlayerLogoutOpcode ( WorldPacket )
protected

Definition at line 1127 of file MiscHandler.cpp.

1128{
1129 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_PLAYER_LOGOUT");
1130 if (!HasGMPermissions())
1131 SendNotification("You do not have permission to perform that function.");
1132 else
1133 LogoutPlayer(true);
1134}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePushQuestToPartyOpcode()

void WorldSession::handlePushQuestToPartyOpcode ( WorldPacket recvPacket)
protected

Definition at line 888 of file QuestHandler.cpp.

889{
890 CmsgPushquesttoparty srlPacket;
891 if (!srlPacket.deserialise(recvPacket))
892 return;
893
894 QuestProperties const* pQuest = sMySQLStore.getQuestProperties(srlPacket.questId);
895 if (pQuest)
896 {
897 if (auto group = _player->getGroup())
898 {
899 uint32_t pguid = _player->getGuidLow();
900 SubGroup* sgr = group ? group->GetSubGroup(_player->getSubGroupSlot()) : nullptr;
901
902 if (sgr)
903 {
904 group->Lock();
905 for (const auto cachedCharacterInfo : sgr->getGroupMembers())
906 {
907 Player* pPlayer = sObjectMgr.getPlayer(cachedCharacterInfo->guid);
908 if (pPlayer && pPlayer->getGuid() != pguid)
909 {
911
912 uint8_t response = QUEST_SHARE_MSG_SHARING_QUEST;
913 uint32_t status = sQuestMgr.PlayerMeetsReqs(pPlayer, pQuest, false);
914
915 if (pPlayer->hasQuestInQuestLog(srlPacket.questId))
916 {
918 }
919 else if (pPlayer->hasQuestFinished(srlPacket.questId))
920 {
922 }
923 else if (status != QuestStatus::Available && status != QuestStatus::AvailableChat)
924 {
926 }
927 else if (pPlayer->getFreeQuestSlot() > MAX_QUEST_SLOT)
928 {
929 response = QUEST_SHARE_MSG_LOG_FULL;
930 }
931 else if (pPlayer->m_duelPlayer)
932 {
933 response = QUEST_SHARE_MSG_BUSY;
934 }
935
936 if (response == QUEST_SHARE_MSG_SHARING_QUEST && !pPlayer->isVisibleObject(_player->getGuid()))
937 {
938 response = QUEST_SHARE_MSG_BUSY;
939 }
940
941 if (response != QUEST_SHARE_MSG_SHARING_QUEST)
942 {
943 sQuestMgr.SendPushToPartyResponse(_player, pPlayer, response);
944 continue;
945 }
946
947 WorldPacket data;
948 sQuestMgr.BuildQuestDetails(&data, pQuest, _player, 1, pPlayer->getSession()->language, pPlayer);
949 pPlayer->setQuestSharerDbId(pguid);
950 pPlayer->getSession()->SendPacket(&data);
951 }
952 }
953 group->Unlock();
954 }
955 }
956 }
957}
#define MAX_QUEST_SLOT
@ QUEST_SHARE_MSG_FINISH_QUEST
@ QUEST_SHARE_MSG_CANT_TAKE_QUEST
@ QUEST_SHARE_MSG_LOG_FULL
@ QUEST_SHARE_MSG_HAVE_QUEST
@ QUEST_SHARE_MSG_SHARING_QUEST
@ QUEST_SHARE_MSG_BUSY
uint8_t getFreeQuestSlot() const
Definition Player.cpp:8850
void setQuestSharerDbId(uint32_t id)
Definition Player.cpp:8923
bool hasQuestInQuestLog(uint32_t questId) const
Definition Player.cpp:8842
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePVPLogDataOpcode()

void WorldSession::handlePVPLogDataOpcode ( WorldPacket )
protected

Definition at line 36 of file BattlegroundHandler.cpp.

37{
38 if (_player->m_bg != nullptr)
40}
void sendPVPData(Player *plr)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQueryGuildBankTabText()

void WorldSession::handleQueryGuildBankTabText ( WorldPacket recvPacket)
private

Definition at line 443 of file GuildHandler.cpp.

444{
445#if VERSION_STRING >= Cata
446 CmsgGuildBankQueryText srlPacket;
447 if (!srlPacket.deserialise(recvPacket))
448 return;
449
450 if (Guild* guild = _player->getGuild())
451 guild->sendBankTabText(this, srlPacket.tabId);
452#endif
453}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQueryTimeOpcode()

void WorldSession::handleQueryTimeOpcode ( WorldPacket recvPacket)
protected

Definition at line 91 of file QueryHandler.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestgiverAcceptQuestOpcode()

void WorldSession::handleQuestgiverAcceptQuestOpcode ( WorldPacket recvPacket)
protected

Definition at line 354 of file QuestHandler.cpp.

355{
357 if (!srlPacket.deserialise(recvPacket))
358 return;
359
360 _player->acceptQuest(srlPacket.guid, srlPacket.questId);
361}
void acceptQuest(uint64_t guid, uint32_t quest_id)
Definition Player.cpp:8642
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestgiverCancelOpcode()

void WorldSession::handleQuestgiverCancelOpcode ( WorldPacket recvPacket)
protected

Definition at line 406 of file QuestHandler.cpp.

407{
408 SendPacket(SmsgGossipComplete().serialise().get());
409
410 sLogger.debug("Sent SMSG_GOSSIP_COMPLETE");
411}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestgiverChooseRewardOpcode()

void WorldSession::handleQuestgiverChooseRewardOpcode ( WorldPacket recvPacket)
protected

Definition at line 806 of file QuestHandler.cpp.

807{
809 if (!srlPacket.deserialise(recvPacket))
810 return;
811
812 if (srlPacket.rewardSlot >= 6)
813 return;
814
815 bool bValid = false;
816 QuestProperties const* qst = nullptr;
817 Object* qst_giver = nullptr;
818
819 if (srlPacket.questgiverGuid.isUnit())
820 {
822 if (quest_giver)
823 qst_giver = quest_giver;
824 else
825 return;
826
827 if (quest_giver->isQuestGiver())
828 {
829 bValid = true;
830 qst = sMySQLStore.getQuestProperties(srlPacket.questId);
831 }
832 }
833 else if (srlPacket.questgiverGuid.isGameObject())
834 {
836 if (quest_giver)
837 qst_giver = quest_giver;
838 else
839 return;
840
841 bValid = true;
842 qst = sMySQLStore.getQuestProperties(srlPacket.questId);
843 }
844
845 if (!qst_giver)
846 {
847 sLogger.debug("Invalid questgiver GUID.");
848 return;
849 }
850
851 if (!bValid || qst == nullptr)
852 {
853 sLogger.debug("Creature is not a questgiver.");
854 return;
855 }
856
858 if (!qle && !qst->is_repeatable)
859 {
860 sLogger.debug("QuestLogEntry not found.");
861 return;
862 }
863
864 if (qle && !qle->canBeFinished())
865 {
866 sLogger.debug("Quest not finished.");
867 return;
868 }
869
870 if (!sQuestMgr.CanStoreReward(_player, qst, srlPacket.rewardSlot))
871 {
872 sQuestMgr.SendQuestFailed(FAILED_REASON_INV_FULL, qst, _player);
873 return;
874 }
875
876 sQuestMgr.OnQuestFinished(_player, qst, qst_giver, srlPacket.rewardSlot);
877
878 if (qst->next_quest_id)
879 {
880 WorldPacket data(12);
881 data.Initialize(CMSG_QUESTGIVER_QUERY_QUEST);
882 data << srlPacket.questgiverGuid.getRawGuid();
883 data << qst->next_quest_id;
885 }
886}
@ CMSG_QUESTGIVER_QUERY_QUEST
Definition Opcodes.hpp:435
@ FAILED_REASON_INV_FULL
bool isQuestGiver() const
Definition Creature.cpp:257
QuestLogEntry * getQuestLogByQuestId(uint32_t questId) const
Definition Player.cpp:8859
bool canBeFinished() const
void handleQuestGiverQueryQuestOpcode(WorldPacket &recvPacket)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestgiverCompleteQuestOpcode()

void WorldSession::handleQuestgiverCompleteQuestOpcode ( WorldPacket recvPacket)
protected

Definition at line 722 of file QuestHandler.cpp.

723{
725 if (!srlPacket.deserialise(recvPacket))
726 return;
727
728 bool bValid = false;
729 QuestProperties const* qst = nullptr;
730 Object* qst_giver = nullptr;
731 uint32_t status = 0;
732
733 if (srlPacket.questgiverGuid.isUnit())
734 {
736 if (quest_giver)
737 qst_giver = quest_giver;
738 else
739 return;
740
741 if (quest_giver->isQuestGiver())
742 {
743 bValid = true;
744 qst = quest_giver->FindQuest(srlPacket.questId, QUESTGIVER_QUEST_END);
745 if (!qst)
746 {
747 sLogger.debug("Cannot complete quest {}, as it doesn't exist at Unit {}.", srlPacket.questId, quest_giver->getEntry());
748 return;
749 }
750 status = sQuestMgr.CalcQuestStatus(qst_giver, _player, qst, static_cast<uint8_t>(quest_giver->GetQuestRelation(qst->id)), false);
751 }
752 }
753 else if (srlPacket.questgiverGuid.isGameObject())
754 {
756 if (quest_giver)
757 qst_giver = quest_giver;
758 else
759 return;
760
761 if (quest_giver->getGoType() == GAMEOBJECT_TYPE_QUESTGIVER)
762 {
763 GameObject_QuestGiver* go_quest_giver = static_cast<GameObject_QuestGiver*>(quest_giver);
764 qst = go_quest_giver->FindQuest(srlPacket.questId, QUESTGIVER_QUEST_END);
765 if (!qst)
766 {
767 sLogger.debug("Cannot complete quest {}, as it doesn't exist at GO {}.", srlPacket.questId, quest_giver->getEntry());
768 return;
769 }
770 status = sQuestMgr.CalcQuestStatus(qst_giver, _player, qst, static_cast<uint8_t>(go_quest_giver->GetQuestRelation(qst->id)), false);
771 bValid = true;
772 }
773 }
774
775 if (!qst_giver)
776 {
777 sLogger.debug("Invalid questgiver GUID.");
778 return;
779 }
780
781 if (!bValid || qst == nullptr)
782 {
783 sLogger.debug("Creature is not a questgiver.");
784 return;
785 }
786
787 if (status == QuestStatus::NotFinished || status == QuestStatus::Repeatable)
788 {
789 WorldPacket data;
790 sQuestMgr.BuildRequestItems(&data, qst, qst_giver, status, language);
791 SendPacket(&data);
792 sLogger.debug("Sent SMSG_QUESTGIVER_REQUEST_ITEMS.");
793 }
794
795 if (status == QuestStatus::Finished)
796 {
797 WorldPacket data;
798 sQuestMgr.BuildOfferReward(&data, qst, qst_giver, 1, language, _player);
799 SendPacket(&data);
800 sLogger.debug("Sent SMSG_QUESTGIVER_REQUEST_ITEMS.");
801 }
802
803 sHookInterface.OnQuestFinished(_player, qst, qst_giver);
804}
@ QUESTGIVER_QUEST_END
uint16_t GetQuestRelation(uint32_t quest_id)
QuestProperties const * FindQuest(uint32_t quest_id, uint8_t quest_relation)
uint16_t GetQuestRelation(uint32_t quest_id)
QuestProperties const * FindQuest(uint32_t quest_id, uint8_t quest_relation)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestgiverHelloOpcode()

void WorldSession::handleQuestgiverHelloOpcode ( WorldPacket recvPacket)
protected

Definition at line 415 of file QuestHandler.cpp.

416{
417 CmsgQuestgiverHello srlPacket;
418 if (!srlPacket.deserialise(recvPacket))
419 return;
420
421 if (const auto questGiver = _player->getWorldMap()->getCreature(srlPacket.questGiverGuid.getGuidLowPart()))
422 {
423 if (!questGiver->isQuestGiver())
424 {
425 sLogger.debug("Creature with guid {} is not a questgiver.", srlPacket.questGiverGuid.getGuidLowPart());
426 return;
427 }
428
429 sQuestMgr.OnActivateQuestGiver(questGiver, _player);
430 }
431 else
432 {
433 sLogger.debug("Invalid questgiver guid {}.", srlPacket.questGiverGuid.getGuidLowPart());
434 }
435}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestGiverQueryQuestOpcode()

void WorldSession::handleQuestGiverQueryQuestOpcode ( WorldPacket recvPacket)
protected

Definition at line 493 of file QuestHandler.cpp.

494{
495 CmsgQuestgiverQueryQuest srlPacket;
496 if (!srlPacket.deserialise(recvPacket))
497 return;
498
499 Object* qst_giver = nullptr;
500
501 bool bValid = false;
502
503 QuestProperties const* qst = sMySQLStore.getQuestProperties(srlPacket.questId);
504 if (!qst)
505 {
506 sLogger.debug("Invalid quest with id {}", srlPacket.questId);
507 return;
508 }
509
510 uint32_t status = QuestStatus::NotAvailable;
511
512 if (srlPacket.guid.isUnit())
513 {
514 Creature* quest_giver = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
515 if (quest_giver)
516 qst_giver = quest_giver;
517 else
518 return;
519 if (quest_giver->isQuestGiver())
520 {
521 bValid = true;
522 status = sQuestMgr.CalcQuestStatus(qst_giver, _player, qst, static_cast<uint8_t>(quest_giver->GetQuestRelation(qst->id)), false);
523 }
524 }
525 else if (srlPacket.guid.isGameObject())
526 {
527 GameObject* quest_giver = _player->getWorldMap()->getGameObject(srlPacket.guid.getGuidLowPart());
528 if (quest_giver)
529 qst_giver = quest_giver;
530 else
531 return;
532 bValid = false;
533 if (quest_giver->getGoType() == GAMEOBJECT_TYPE_QUESTGIVER)
534 {
535 bValid = true;
536 if (auto go_quest_giver = dynamic_cast<GameObject_QuestGiver*>(quest_giver))
537 status = sQuestMgr.CalcQuestStatus(qst_giver, _player, qst, static_cast<uint8_t>(go_quest_giver->GetQuestRelation(qst->id)), false);
538 }
539 }
540 else if (srlPacket.guid.isItem())
541 {
542 Item* quest_giver = _player->getItemInterface()->GetItemByGUID(srlPacket.guid.getRawGuid());
543 if (quest_giver)
544 qst_giver = quest_giver;
545 else
546 return;
547
548 const auto itemProto = quest_giver->getItemProperties();
549 if (itemProto->Bonding != ITEM_BIND_ON_USE || quest_giver->isSoulbound())
550 {
551 if (sScriptMgr.CallScriptedItem(quest_giver, _player))
552 return;
553 }
554
555 if (itemProto->Bonding == ITEM_BIND_ON_USE)
556 quest_giver->addFlags(ITEM_FLAG_SOULBOUND);
557
558 bValid = true;
559 status = sQuestMgr.CalcQuestStatus(qst_giver, _player, qst, 1, false);
560 }
561
562 if (!qst_giver)
563 {
564 sLogger.debug("Invalid questgiver GUID.");
565 return;
566 }
567
568 if (!bValid)
569 {
570 sLogger.debug("object is not a questgiver.");
571 return;
572 }
573
574 WorldPacket data;
575
576 if ((status == QuestStatus::Available) || (status == QuestStatus::Repeatable) || (status == QuestStatus::AvailableChat))
577 {
578 sQuestMgr.BuildQuestDetails(&data, qst, qst_giver, 1, language, _player);
579 SendPacket(&data);
580 sLogger.debug("Sent SMSG_QUESTGIVER_QUEST_DETAILS.");
581
583 _player->acceptQuest(qst_giver->getGuid(), qst->id);
584 }
585 else if (status == QuestStatus::NotFinished || status == QuestStatus::Finished)
586 {
587 sQuestMgr.BuildRequestItems(&data, qst, qst_giver, status, language);
588 SendPacket(&data);
589 sLogger.debug("Sent SMSG_QUESTGIVER_REQUEST_ITEMS.");
590 }
591}
@ ITEM_BIND_ON_USE
@ QUEST_FLAGS_AUTO_ACCEPT
use Objective text as Complete text
#define sScriptMgr
bool isSoulbound() const
Definition Item.hpp:218
bool HasFlag(uint32_t flag) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestgiverRequestRewardOpcode()

void WorldSession::handleQuestgiverRequestRewardOpcode ( WorldPacket recvPacket)
protected

Definition at line 644 of file QuestHandler.cpp.

645{
647 if (!srlPacket.deserialise(recvPacket))
648 return;
649
650 bool bValid = false;
651 QuestProperties const* qst = nullptr;
652 Object* qst_giver = nullptr;
653 uint32_t status = 0;
654
655 if (srlPacket.questgiverGuid.isUnit())
656 {
658 if (quest_giver)
659 qst_giver = quest_giver;
660 else
661 return;
662
663 if (quest_giver->isQuestGiver())
664 {
665 bValid = true;
666 qst = quest_giver->FindQuest(srlPacket.questId, QUESTGIVER_QUEST_END);
667 if (!qst)
668 qst = quest_giver->FindQuest(srlPacket.questId, QUESTGIVER_QUEST_START);
669
670 if (!qst)
671 {
672 sLogger.debug("Cannot get reward for quest {}, as it doesn't exist at Unit {}.", srlPacket.questId, quest_giver->getEntry());
673 return;
674 }
675 status = sQuestMgr.CalcQuestStatus(qst_giver, _player, qst, static_cast<uint8_t>(quest_giver->GetQuestRelation(qst->id)), false);
676 }
677 }
678 else if (srlPacket.questgiverGuid.isGameObject())
679 {
681 if (quest_giver)
682 qst_giver = quest_giver;
683 else
684 return;
685
686 bValid = false;
687 if (quest_giver->getGoType() == GAMEOBJECT_TYPE_QUESTGIVER)
688 {
689 bValid = true;
690 GameObject_QuestGiver* go_quest_giver = static_cast<GameObject_QuestGiver*>(quest_giver);
691 qst = go_quest_giver->FindQuest(srlPacket.questId, QUESTGIVER_QUEST_END);
692 if (!qst)
693 {
694 sLogger.debug("Cannot get reward for quest {}, as it doesn't exist at GO {}.", srlPacket.questId, quest_giver->getEntry());
695 return;
696 }
697 status = sQuestMgr.CalcQuestStatus(qst_giver, _player, qst, static_cast<uint8_t>(go_quest_giver->GetQuestRelation(qst->id)), false);
698 }
699 }
700
701 if (!qst_giver)
702 {
703 sLogger.debug("Invalid questgiver GUID.");
704 return;
705 }
706
707 if (!bValid || qst == nullptr)
708 {
709 sLogger.debug("Creature is not a questgiver.");
710 return;
711 }
712
713 if (status == QuestStatus::Finished)
714 {
715 WorldPacket data;
716 sQuestMgr.BuildOfferReward(&data, qst, qst_giver, 1, language, _player);
717 SendPacket(&data);
718 sLogger.debug("Sent SMSG_QUESTGIVER_REQUEST_ITEMS.");
719 }
720}
@ QUESTGIVER_QUEST_START
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestgiverStatusQueryOpcode()

void WorldSession::handleQuestgiverStatusQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 437 of file QuestHandler.cpp.

438{
440 if (!srlPacket.deserialise(recvPacket))
441 return;
442
443 if (_player->IsInBg())
444 return;
445
446 Object* qst_giver = nullptr;
447
448 if (srlPacket.questGiverGuid.isUnit())
449 {
451 if (quest_giver)
452 qst_giver = quest_giver;
453 else
454 return;
455
456 if (!quest_giver->isQuestGiver())
457 {
458 sLogger.debug("Creature is not a questgiver.");
459 return;
460 }
461 }
462 else if (srlPacket.questGiverGuid.isItem())
463 {
464 Item* quest_giver = _player->getItemInterface()->GetItemByGUID(srlPacket.questGiverGuid.getRawGuid());
465 if (quest_giver)
466 qst_giver = quest_giver;
467 else
468 return;
469 }
470 else if (srlPacket.questGiverGuid.isGameObject())
471 {
473 if (quest_giver)
474 qst_giver = quest_giver;
475 else
476 return;
477 }
478
479 if (!qst_giver)
480 {
481 sLogger.debug("Invalid questgiver GUID {}.", std::to_string(srlPacket.questGiverGuid.getRawGuid()));
482 return;
483 }
484
485#if VERSION_STRING < Cata
486 const auto questStatus = static_cast<uint8_t>(sQuestMgr.CalcStatus(qst_giver, _player));
487#else
488 const auto questStatus = sQuestMgr.CalcStatus(qst_giver, _player);
489#endif
490 SendPacket(SmsgQuestgiverStatus(srlPacket.questGiverGuid.getRawGuid(), questStatus).serialise().get());
491}
bool IsInBg()
Definition Object.cpp:4412
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestlogRemoveQuestOpcode()

void WorldSession::handleQuestlogRemoveQuestOpcode ( WorldPacket recvPacket)
protected

Definition at line 593 of file QuestHandler.cpp.

594{
595 CmsgQuestlogRemoveQuest srlPacket;
596 if (!srlPacket.deserialise(recvPacket))
597 return;
598
599 if (srlPacket.questLogSlot >= 25)
600 return;
601
603 if (!qEntry)
604 {
605 sLogger.debug(" No quest in slot {}.", srlPacket.questLogSlot);
606 return;
607 }
608 QuestProperties const* qPtr = qEntry->getQuestProperties();
609
610 if (const auto questScript = qEntry->getQuestScript())
611 questScript->OnQuestCancel(_player);
612
613 qEntry->finishAndRemove();
614
615 for (uint8_t i = 0; i < 4; ++i)
616 {
617 if (qPtr->receive_items[i])
619 }
620
621 if (qPtr->srcitem && qPtr->srcitem != qPtr->receive_items[0])
622 {
623 ItemProperties const* itemProto = sMySQLStore.getItemProperties(qPtr->srcitem);
624 if (itemProto != nullptr)
625 if (itemProto->QuestId != qPtr->id)
627 }
628
629 for (uint8_t i = 0; i < MAX_REQUIRED_QUEST_ITEM; ++i)
630 {
631 if (qPtr->required_item[i] != 0)
632 {
633 ItemProperties const* itemProto = sMySQLStore.getItemProperties(qPtr->required_item[i]);
634 if (itemProto != nullptr && itemProto->Class == ITEM_CLASS_QUEST)
636 }
637 }
638
640
641 sHookInterface.OnQuestCancelled(_player, qPtr);
642}
@ ITEM_CLASS_QUEST
QuestLogEntry * getQuestLogBySlotId(uint32_t slotId) const
Definition Player.cpp:8869
void updateNearbyQuestGameObjects()
Definition Player.cpp:9043
QuestScript * getQuestScript() const
QuestProperties const * getQuestProperties() const
uint32_t required_itemcount[MAX_REQUIRED_QUEST_ITEM]
uint32_t receive_items[4]
uint32_t required_item[MAX_REQUIRED_QUEST_ITEM]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestPOIQueryOpcode()

void WorldSession::handleQuestPOIQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 381 of file QuestHandler.cpp.

382{
383#if VERSION_STRING > TBC
384 CmsgQuestPoiQuery srlPacket;
385 if (!srlPacket.deserialise(recvPacket))
386 return;
387
388 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_QUEST_POI_QUERY");
389
390 if (srlPacket.questCount > MAX_QUEST_LOG_SIZE)
391 {
392 sLogger.debug("Client sent Quest POI query for more than MAX_QUEST_LOG_SIZE quests.");
393
394 srlPacket.questCount = MAX_QUEST_LOG_SIZE;
395 }
396
397 WorldPacket data(SMSG_QUEST_POI_QUERY_RESPONSE, 4 + (4 + 4) * srlPacket.questCount);
398 data << srlPacket.questCount;
399 for (auto questId : srlPacket.questIds)
400 sQuestMgr.BuildQuestPOIResponse(data, questId);
401
402 SendPacket(&data);
403#endif
404}
@ SMSG_QUEST_POI_QUERY_RESPONSE
Definition Opcodes.hpp:1158
#define MAX_QUEST_LOG_SIZE
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestPushResultOpcode()

void WorldSession::handleQuestPushResultOpcode ( WorldPacket recvPacket)
protected

Definition at line 334 of file QuestHandler.cpp.

335{
336 MsgQuestPushResult srlPacket;
337 if (!srlPacket.deserialise(recvPacket))
338 return;
339
340 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_QUEST_PUSH_RESULT");
341
343 {
344 const auto questSharerPlayer = sObjectMgr.getPlayer(_player->getQuestSharerByDbId());
345 if (questSharerPlayer)
346 {
347 const uint64_t guid = recvPacket.size() >= 13 ? _player->getGuid() : srlPacket.giverGuid;
348 questSharerPlayer->getSession()->SendPacket(MsgQuestPushResult(guid, 0, srlPacket.pushResult).serialise().get());
350 }
351 }
352}
uint32_t getQuestSharerByDbId() const
Definition Player.cpp:8922
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuestQueryOpcode()

void WorldSession::handleQuestQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 363 of file QuestHandler.cpp.

364{
365 CmsgQuestQuery srlPacket;
366 if (!srlPacket.deserialise(recvPacket))
367 return;
368
369 if (const auto questProperties = sMySQLStore.getQuestProperties(srlPacket.questId))
370 {
371 auto worldPacket = buildQuestQueryResponse(questProperties);
372 SendPacket(worldPacket.get());
373 }
374 else
375 {
376 sLogger.debug("Invalid quest Id {}.", srlPacket.questId);
377 }
378}
std::unique_ptr< WorldPacket > buildQuestQueryResponse(QuestProperties const *qst)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRaidDifficultyOpcode()

void WorldSession::handleRaidDifficultyOpcode ( WorldPacket recvPacket)
protected

Definition at line 517 of file MiscHandler.cpp.

518{
519#if VERSION_STRING > TBC
520 MsgSetRaidDifficulty srlPacket;
521 if (!srlPacket.deserialise(recvPacket))
522 return;
523
524 if (srlPacket.difficulty >= InstanceDifficulty::MAX_RAID_DIFFICULTY)
525 return;
526
527 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_SET_RAID_DIFFICULTY: {} (difficulty)", srlPacket.difficulty);
528
529 // cannot reset while in an instance
530 WorldMap* map = _player->getWorldMap();
531 if (map && map->getBaseMap()->isInstanceMap())
532 return;
533
534 if (InstanceDifficulty::Difficulties(srlPacket.difficulty) == _player->getRaidDifficulty())
535 return;
536
537 if (const auto group = _player->getGroup())
538 {
539 if (_player->isGroupLeader())
540 {
541 group->resetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player);
542 group->SetRaidDifficulty(InstanceDifficulty::Difficulties(srlPacket.difficulty));
543 }
544 }
545 else
546 {
549 }
550#endif
551}
uint8_t getRaidDifficulty()
Definition Player.cpp:7251
void setRaidDifficulty(uint8_t diff)
Definition Player.cpp:7246
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRandomRollOpcode()

void WorldSession::handleRandomRollOpcode ( WorldPacket recvPacket)
protected

Definition at line 410 of file MiscHandler.cpp.

411{
412 MsgRandomRoll srlPacket;
413 if (!srlPacket.deserialise(recvPacket))
414 return;
415
416 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_RANDOM_ROLL: {} (min), {} (max)", srlPacket.min, srlPacket.max);
417
418 uint32_t maxValue = srlPacket.max;
419 uint32_t minValue = srlPacket.min;
420
421 if (maxValue > RAND_MAX)
422 maxValue = RAND_MAX;
423
424 if (minValue > maxValue)
425 minValue = maxValue;
426
427 uint32_t randomRoll = Util::getRandomUInt(maxValue - minValue) + minValue;
428
429 if (_player->isInGroup())
430 _player->getGroup()->SendPacketToAll(MsgRandomRoll(minValue, maxValue, randomRoll, _player->getGuid()).serialise().get());
431 else
432 SendPacket(MsgRandomRoll(minValue, maxValue, randomRoll, _player->getGuid()).serialise().get());
433}
uint32_t getRandomUInt(uint32_t end)
Definition Random.cpp:32
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleReadItemOpcode()

void WorldSession::handleReadItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 2563 of file ItemHandler.cpp.

2564{
2565 CmsgReadItem srlPacket;
2566 if (!srlPacket.deserialise(recvPacket))
2567 return;
2568
2569 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_READ_ITEM {}", srlPacket.srcSlot);
2570
2571 Item* item = _player->getItemInterface()->GetInventoryItem(srlPacket.srcContainerSlot, srlPacket.srcSlot);
2572 if (item)
2573 {
2574 // Check if it has pagetext
2575 if (item->getItemProperties()->PageId)
2576 SendPacket(SmsgReadItemOk(item->getGuid()).serialise().get());
2577 else
2578 SendPacket(SmsgReadItemFailed(item->getGuid(), 2).serialise().get());
2579 }
2580}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleReadyCheckOpcode()

void WorldSession::handleReadyCheckOpcode ( WorldPacket recvPacket)
private

Definition at line 864 of file GroupHandler.cpp.

865{
866 const auto group = _player->getGroup();
867 if (group == nullptr)
868 return;
869
870 if (recvPacket.isEmpty())
871 {
872 if (group->GetLeader() == _player->getPlayerInfo() || group->GetAssistantLeader() == _player->getPlayerInfo())
873 group->SendPacketToAll(MsgRaidReadyCheck(_player->getGuid(), 0, true).serialise().get());
874 else
875 SendNotification("You do not have permission to perform that function.");
876 }
877 else
878 {
879 MsgRaidReadyCheck srlPacket;
880 if (!srlPacket.deserialise(recvPacket))
881 return;
882
883 if (group->GetLeader())
884 if (Player* leader = sObjectMgr.getPlayer(group->GetLeader()->guid))
885 leader->sendPacket(MsgRaidReadyCheck(_player->getGuid(), srlPacket.isReady, false).serialise().get());
886
887 if (group->GetAssistantLeader())
888 if (Player* assistant = sObjectMgr.getPlayer(group->GetAssistantLeader()->guid))
889 assistant->sendPacket(MsgRaidReadyCheck(_player->getGuid(), srlPacket.isReady, false).serialise().get());
890 }
891}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleReadyForAccountDataTimes()

void WorldSession::handleReadyForAccountDataTimes ( WorldPacket )
protected

Definition at line 1075 of file MiscHandler.cpp.

1076{
1077 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_READY_FOR_ACCOUNT_DATA_TIMES");
1078
1080}
const uint8_t GLOBAL_CACHE_MASK
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRealmSplitOpcode()

void WorldSession::handleRealmSplitOpcode ( WorldPacket recvPacket)
protected

Definition at line 435 of file MiscHandler.cpp.

436{
437 CmsgRealmSplit srlPacket;
438 if (!srlPacket.deserialise(recvPacket))
439 return;
440
441 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REALM_SPLIT: {} (unk)", srlPacket.unknown);
442
443 const std::string dateFormat = "01/01/01";
444
445 SendPacket(SmsgRealmSplit(srlPacket.unknown, 0, dateFormat).serialise().get());
446}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleReforgeItemOpcode()

void WorldSession::handleReforgeItemOpcode ( WorldPacket recvData)

Definition at line 670 of file ItemHandler.cpp.

671{
672#if VERSION_STRING == Cata
673 uint32_t slot, reforgeEntry;
674 ObjectGuid guid;
675 uint32_t bag;
676 Player* player = GetPlayer();
677
678 recvData >> reforgeEntry >> slot >> bag;
679
680 guid[2] = recvData.readBit();
681 guid[6] = recvData.readBit();
682 guid[3] = recvData.readBit();
683 guid[4] = recvData.readBit();
684 guid[1] = recvData.readBit();
685 guid[0] = recvData.readBit();
686 guid[7] = recvData.readBit();
687 guid[5] = recvData.readBit();
688
689 recvData.ReadByteSeq(guid[2]);
690 recvData.ReadByteSeq(guid[3]);
691 recvData.ReadByteSeq(guid[6]);
692 recvData.ReadByteSeq(guid[4]);
693 recvData.ReadByteSeq(guid[1]);
694 recvData.ReadByteSeq(guid[0]);
695 recvData.ReadByteSeq(guid[7]);
696 recvData.ReadByteSeq(guid[5]);
697
698 Creature* creature = player->getWorldMapCreature(guid);
699 if (!creature)
700 {
701 sLogger.debug("handleReforgeItemOpcode - Unit (GUID: {}) not found.", uint64_t(guid));
702 sendReforgeResult(false);
703 return;
704 }
705
706 // Validate
707 if (!creature->isReforger() && creature->getDistance(player) > 5.0f)
708 {
709 sLogger.debug("handleReforgeItemOpcode - Unit (GUID: {}) can't interact with it or is no Reforger.", uint64_t(guid));
710 sendReforgeResult(false);
711 return;
712 }
713
714 Item* item = player->getItemInterface()->GetInventoryItem(bag, slot);
715
716 if (!item)
717 {
718 sLogger.debug("handleReforgeItemOpcode - Player (Guid: {} Name: {}) tried to reforge an invalid/non-existant item.", player->getGuidLow(), player->getName());
719 sendReforgeResult(false);
720 return;
721 }
722
723 if (!reforgeEntry)
724 {
725 // Reset the item
727 sendReforgeResult(true);
728 return;
729 }
730
731 WDB::Structures::ItemReforgeEntry const* stats = sItemReforgeStore.lookupEntry(reforgeEntry);
732 if (!stats)
733 {
734 sLogger.debug("handleReforgeItemOpcode - Player (Guid: {} Name: {}) tried to reforge an item with invalid reforge entry ({}).", player->getGuidLow(), player->getName(), reforgeEntry);
735 sendReforgeResult(false);
736 return;
737 }
738
739 if (!item->getReforgableStat(ItemModType(stats->SourceStat)) || item->getReforgableStat(ItemModType(stats->FinalStat))) // Cheating, you cant reforge to a stat that the item already has, nor reforge from a stat that the item does not have
740 {
741 sendReforgeResult(false);
742 return;
743 }
744
745 // todo implement special prices
746 if (player->getCoinage() < uint64_t(100000)) // cheating
747 {
748 sendReforgeResult(false);
749 return;
750 }
751
752 player->modCoinage(-int64_t(100000));
753
754 item->addEnchantment(reforgeEntry, REFORGE_ENCHANTMENT_SLOT, 0);
755 sendReforgeResult(true);
756#endif
757}
ItemModType
@ REFORGE_ENCHANTMENT_SLOT
bool isReforger() const
Definition Creature.cpp:272
int32_t getReforgableStat(ItemModType statType) const
Definition Item.cpp:1170
float getDistance(Object const *obj) const
Definition Object.cpp:5040
void sendReforgeResult(bool success)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRemoveGlyph()

void WorldSession::handleRemoveGlyph ( WorldPacket recvPacket)
protected

Definition at line 1601 of file MiscHandler.cpp.

1602{
1603#if VERSION_STRING > TBC
1604 CmsgRemoveGlyph srlPacket;
1605 if (!srlPacket.deserialise(recvPacket))
1606 return;
1607
1608 if (srlPacket.glyphNumber > 5)
1609 return;
1610
1611 const uint32_t glyphId = _player->getGlyph(srlPacket.glyphNumber);
1612 if (glyphId == 0)
1613 return;
1614
1615 const auto glyphPropertiesEntry = sGlyphPropertiesStore.lookupEntry(glyphId);
1616 if (!glyphPropertiesEntry)
1617 return;
1618
1619 _player->setGlyph(srlPacket.glyphNumber, 0);
1620 _player->removeAllAurasById(glyphPropertiesEntry->SpellID);
1621 _player->m_specs[_player->m_talentActiveSpec].setGlyph(0, srlPacket.glyphNumber);
1622 _player->smsg_TalentsInfo(false);
1623#endif
1624}
SERVER_DECL WDB::WDBContainer< WDB::Structures::GlyphPropertiesEntry > sGlyphPropertiesStore
void setGlyph(uint16_t slot, uint32_t glyph)
Definition Player.cpp:1310
uint32_t getGlyph(uint16_t slot) const
Definition Player.cpp:1309
uint8_t m_talentActiveSpec
Definition Player.hpp:1988
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRemoveVehiclePassenger()

void WorldSession::handleRemoveVehiclePassenger ( WorldPacket recvPacket)
protected

Definition at line 204 of file VehicleHandler.cpp.

205{
206#if VERSION_STRING > TBC
207 Vehicle* vehicle = _player->getVehicleKit();
208 if (!vehicle)
209 {
210 recvPacket.rfinish(); // prevent warnings spam
211 return;
212 }
213
214 CmsgEjectPassenger srlPacket;
215 if (!srlPacket.deserialise(recvPacket))
216 return;
217
218 if (srlPacket.guid == 0)
219 return;
220
221 const auto passengerUnit = _player->getWorldMap()->getUnit(srlPacket.guid);
222 if (!passengerUnit)
223 return;
224
225 if (!passengerUnit->isOnVehicle(vehicle->getBase()))
226 return;
227
228 auto seat = vehicle->getSeatForPassenger(passengerUnit);
229 if (seat)
230 if (seat->isEjectable())
231 passengerUnit->callExitVehicle();
232#endif
233}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRepairItemOpcode()

void WorldSession::handleRepairItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 2582 of file ItemHandler.cpp.

2583{
2584 CmsgRepairItem srlPacket;
2585 if (!srlPacket.deserialise(recvPacket))
2586 return;
2587
2588 Creature* pCreature = _player->getWorldMap()->getCreature(srlPacket.creatureGuid.getGuidLowPart());
2589 if (pCreature == nullptr)
2590 return;
2591
2592 if (!pCreature->isArmorer())
2593 return;
2594
2595 //this is a blizzlike check
2596 if (_player->getDistanceSq(pCreature) > 100)
2597 return; //avoid talking to anyone by guid hacking. Like repair items anytime in raid ? Low chance hack
2598
2599 if (!srlPacket.itemGuid)
2600 {
2601 int32_t totalcost = 0;
2602 for (uint32_t i = 0; i < MAX_INVENTORY_SLOT; i++)
2603 {
2604 Item* pItem = _player->getItemInterface()->GetInventoryItem(static_cast<int16_t>(i));
2605 if (pItem != nullptr)
2606 {
2607 if (pItem->isContainer())
2608 {
2609 if (const auto pContainer = dynamic_cast<Container*>(pItem))
2610 {
2611 for (uint32_t j = 0; j < pContainer->getItemProperties()->ContainerSlots; ++j)
2612 {
2613 pItem = pContainer->getItem(static_cast<int16_t>(j));
2614 if (pItem != nullptr)
2615 pItem->repairItem(_player, srlPacket.isInGuild, &totalcost);
2616 }
2617 }
2618 }
2619 else
2620 {
2621 if (i < INVENTORY_SLOT_BAG_END)
2622 {
2623 if (pItem->getDurability() == 0 && pItem->repairItem(_player, srlPacket.isInGuild, &totalcost))
2624 _player->applyItemMods(pItem, static_cast<int16_t>(i), true);
2625 else
2626 pItem->repairItem(_player, srlPacket.isInGuild, &totalcost);
2627 }
2628 }
2629 }
2630 }
2631 }
2632 else
2633 {
2634 Item* item = _player->getItemInterface()->GetItemByGUID(srlPacket.itemGuid);
2635 if (item)
2636 {
2637 //this never gets null since we get a pointer to the inteface internal var
2639 uint32_t dDurability = item->getMaxDurability() - item->getDurability();
2640
2641 if (dDurability)
2642 {
2643 uint32_t cDurability = item->getDurability();
2644 //only apply item mods if they are on char equipped
2645 if (item->repairItem(_player) && cDurability == 0
2646 && searchres->ContainerSlot == static_cast<int8_t>(INVALID_BACKPACK_SLOT)
2647 && searchres->Slot < static_cast<int8_t>(INVENTORY_SLOT_BAG_END))
2648 _player->applyItemMods(item, searchres->Slot, true);
2649 }
2650 }
2651 }
2652 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REPAIR_ITEM {}", srlPacket.itemGuid);
2653}
#define MAX_INVENTORY_SLOT
bool isArmorer() const
Definition Creature.cpp:269
SlotResult * LastSearchResult()
bool repairItem(Player *player, bool isGuildMoney=false, int32_t *repairCost=nullptr)
Definition Item.cpp:894
uint32_t getDurability() const
Definition Item.cpp:216
uint32_t getMaxDurability() const
Definition Item.cpp:219
void applyItemMods(Item *item, int16_t slot, bool apply, bool justBrokedown=false, bool skipStatApply=false)
Definition Player.cpp:6972
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRepopRequestOpcode()

void WorldSession::handleRepopRequestOpcode ( WorldPacket )
protected

Definition at line 1709 of file MiscHandler.cpp.

1710{
1711 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REPOP_REQUEST");
1712
1714 return;
1715
1716 if (_player->getTransGuid())
1717 {
1718 auto transport = _player->GetTransport();
1719 if (transport != nullptr)
1720 transport->RemovePassenger(_player);
1721 }
1722
1724}
@ JUST_DIED
void repopRequest()
Definition Player.cpp:7545
DeathState getDeathState() const
Definition Unit.cpp:7924
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleReportLag()

void WorldSession::handleReportLag ( WorldPacket recvPacket)
protected

Definition at line 82 of file GMTicketHandler.cpp.

83{
84#if VERSION_STRING > TBC
85 CmsgGmReportLag srlPacket;
86 if (!srlPacket.deserialise(recvPacket))
87 return;
88
89 if (_player != nullptr)
90 {
91 CharacterDatabase.Execute("INSERT INTO lag_reports (player, account, lag_type, map_id, position_x, position_y, position_z) VALUES(%u, %u, %u, %u, %f, %f, %f)",
92 _player->getGuidLow(), _accountId, srlPacket.lagType, srlPacket.mapId, srlPacket.location.x, srlPacket.location.y, srlPacket.location.z);
93
94 sLogger.debug("Player {} has reported a lagreport with Type: {} on Map: {}", _player->getName(), srlPacket.lagType, srlPacket.mapId);
95 }
96
97#endif
98}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleReportOpcode()

void WorldSession::handleReportOpcode ( WorldPacket recvPacket)
protected

Definition at line 2301 of file MiscHandler.cpp.

2302{
2303#if VERSION_STRING >= Cata
2304 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REPORT");
2305
2306 uint8_t spam_type; // 0 - mail, 1 - chat
2307 uint64_t spammer_guid;
2308 uint32_t unk1 = 0;
2309 uint32_t unk2 = 0;
2310 uint32_t unk3 = 0;
2311 uint32_t unk4 = 0;
2312
2313 std::string description;
2314 recvPacket >> spam_type; // unk 0x01 const, may be spam type (mail/chat)
2315 recvPacket >> spammer_guid; // player guid
2316
2317 switch (spam_type)
2318 {
2319 case 0:
2320 {
2321 recvPacket >> unk1; // const 0
2322 recvPacket >> unk2; // probably mail id
2323 recvPacket >> unk3; // const 0
2324
2325 sLogger.debug("Received REPORT SPAM: type {}, guid {}, unk1 {}, unk2 {}, unk3 {}", spam_type, WoWGuid::getGuidLowPartFromUInt64(spammer_guid), unk1, unk2, unk3);
2326
2327 } break;
2328 case 1:
2329 {
2330 recvPacket >> unk1; // probably language
2331 recvPacket >> unk2; // message type?
2332 recvPacket >> unk3; // probably channel id
2333 recvPacket >> unk4; // unk random value
2334 recvPacket >> description; // spam description string (messagetype, channel name, player name, message)
2335
2336 sLogger.debug("Received REPORT SPAM: type {}, guid {}, unk1 {}, unk2 {}, unk3 {}, unk4 {}, message {}", spam_type, WoWGuid::getGuidLowPartFromUInt64(spammer_guid), unk1, unk2, unk3, unk4, description);
2337
2338 } break;
2339 }
2340
2341 // Complaint Received message
2343 data << uint8_t(0); // 1 reset reported player 0 ignore
2344 data << uint8_t(0);
2345
2346 SendPacket(&data);
2347#endif
2348}
@ SMSG_REPORT_RESULT
Definition Opcodes.hpp:1714
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleReportPlayerOpcode()

void WorldSession::handleReportPlayerOpcode ( WorldPacket recvPacket)
protected

Definition at line 2350 of file MiscHandler.cpp.

2351{
2352#if VERSION_STRING >= Cata
2353 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REPORT_PLAYER {}", static_cast<uint32_t>(recvPacket.size()));
2354
2355 uint8_t unk3 = 0; // type
2356 uint8_t unk4 = 0; // guid - 1
2357 uint32_t unk5 = 0;
2358 uint64_t unk6 = 0;
2359 uint32_t unk7 = 0;
2360 uint32_t unk8 = 0;
2361
2362 std::string message;
2363
2364 uint32_t length = recvPacket.readBits(9); // length * 2
2365 recvPacket >> unk3; // type
2366 recvPacket >> unk4; // guid - 1?
2367 message = recvPacket.ReadString(length / 2); // message
2368 recvPacket >> unk5; // unk
2369 recvPacket >> unk6; // unk
2370 recvPacket >> unk7; // unk
2371 recvPacket >> unk8; // unk
2372
2373 switch (unk3)
2374 {
2375 case 0: // chat spamming
2376 sLogger.debug("Chat spamming report for guid: {} received.", unk4 + 1);
2377 break;
2378 case 2: // cheat
2379 recvPacket >> message;
2380 sLogger.debug("Cheat report for guid: {} received. Message {}", unk4 + 1, message);
2381 break;
2382 case 6: // char name
2383 recvPacket >> message;
2384 sLogger.debug("char name report for guid: {} received. Message {}", unk4 + 1, message);
2385 break;
2386 case 12: // guild name
2387 recvPacket >> message;
2388 sLogger.debug("guild name report for guid: {} received. Message {}", unk4 + 1, message);
2389 break;
2390 case 18: // arena team name
2391 recvPacket >> message;
2392 sLogger.debug("arena team name report for guid: {} received. Message {}", unk4 + 1, message);
2393 break;
2394 case 20: // chat language
2395 sLogger.debug("Chat language report for guid: {} received.", unk4 + 1);
2396 break;
2397 default:
2398 sLogger.debug("type is {}", unk3);
2399 break;
2400 }
2401#endif
2402}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleReportSpamOpcode()

void WorldSession::handleReportSpamOpcode ( WorldPacket recvPacket)
protected

Definition at line 553 of file ChatHandler.cpp.

554{
555#if VERSION_STRING < Cata
556 CmsgComplaint srlPacket;
557 if (!srlPacket.deserialise(recvPacket))
558 return;
559
560 sLogger.debug("REPORT SPAM: type {}, guid {}, unk1 {}, unk2 {}, unk3 {}, unk4 {}, message {}", srlPacket.spam_type, srlPacket.spammer_guid.getGuidLow(),
561 srlPacket.unk1, srlPacket.unk2, srlPacket.unk3, srlPacket.unk4, srlPacket.description);
562
563 SendPacket(SmsgComplainResult(0).serialise().get());
564#endif
565}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRequestAccountData()

void WorldSession::handleRequestAccountData ( WorldPacket recvPacket)
protected

Definition at line 889 of file MiscHandler.cpp.

890{
891 if (!worldConfig.server.useAccountData)
892 return;
893
894 uint32_t accountDataId;
895 recvPacket >> accountDataId;
896
897 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REQUEST_ACCOUNT_DATA id {}.", accountDataId);
898
899 if (accountDataId > 8)
900 {
901 sLogger.debug("CMSG_REQUEST_ACCOUNT_DATA: Accountdata > 8 ({}) was requested by {} of account {}!", accountDataId, _player->getName(), this->GetAccountId());
902 return;
903 }
904
905 AccountDataEntry* accountDataEntry = GetAccountData(accountDataId);
906 WorldPacket data;
908 data << accountDataId;
909
910 if (!accountDataEntry || !accountDataEntry->data)
911 {
912 data << uint32_t(0);
913 }
914 else
915 {
916 data << accountDataEntry->sz;
917
918 if (accountDataEntry->sz > 200)
919 {
920 data.resize(accountDataEntry->sz + 800);
921
922 uLongf destSize;
923 if (compress(data.contents() + (sizeof(uint32_t) * 2), &destSize, reinterpret_cast<const uint8_t*>(accountDataEntry->data.get()), accountDataEntry->sz) != Z_OK)
924 {
925 sLogger.debug("CMSG_REQUEST_ACCOUNT_DATA: Error while compressing data");
926 return;
927 }
928
929 data.resize(destSize + 8);
930 }
931 else
932 {
933 data.append(accountDataEntry->data.get(), accountDataEntry->sz);
934 }
935 }
936
937 SendPacket(&data);
938}
@ SMSG_UPDATE_ACCOUNT_DATA
Definition Opcodes.hpp:582
void append(T value)
Definition ByteBuffer.h:78
AccountDataEntry * GetAccountData(uint32_t index)
std::unique_ptr< char[]> data
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRequestCemeteryListOpcode()

void WorldSession::handleRequestCemeteryListOpcode ( WorldPacket )
protected

Definition at line 1574 of file MiscHandler.cpp.

1575{
1576#if VERSION_STRING >= Cata
1577 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REQUEST_CEMETERY_LIST");
1578
1579 auto result = WorldDatabase.Query("SELECT id FROM graveyards WHERE faction = %u OR faction = 3;", _player->getTeam());
1580 if (result)
1581 {
1582 WorldPacket data(SMSG_REQUEST_CEMETERY_LIST_RESPONSE, 8 * result->GetRowCount());
1583 data.writeBit(false); // unk bit
1584 data.flushBits();
1585 data.writeBits(result->GetRowCount(), 24);
1586 data.flushBits();
1587
1588 do
1589 {
1590 Field* field = result->Fetch();
1591 data << uint32_t(field[0].asUint32());
1592 } while (result->NextRow());
1593
1594 SendPacket(&data);
1595 }
1596#endif
1597}
#define WorldDatabase
@ SMSG_REQUEST_CEMETERY_LIST_RESPONSE
Definition Opcodes.hpp:1716
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRequestHotfix()

void WorldSession::handleRequestHotfix ( WorldPacket recvPacket)
protected

Definition at line 1464 of file MiscHandler.cpp.

1465{
1466#if VERSION_STRING >= Cata
1467#if VERSION_STRING == Cata
1468 uint32_t type;
1469 recvPacket >> type;
1470
1471 uint32_t count = recvPacket.readBits(23);
1472
1473 auto guids = std::make_unique<ObjectGuid[]>(count);
1474 for (uint32_t i = 0; i < count; ++i)
1475 {
1476 guids[i][0] = recvPacket.readBit();
1477 guids[i][4] = recvPacket.readBit();
1478 guids[i][7] = recvPacket.readBit();
1479 guids[i][2] = recvPacket.readBit();
1480 guids[i][5] = recvPacket.readBit();
1481 guids[i][3] = recvPacket.readBit();
1482 guids[i][6] = recvPacket.readBit();
1483 guids[i][1] = recvPacket.readBit();
1484 }
1485
1486 uint32_t entry;
1487 for (uint32_t i = 0; i < count; ++i)
1488 {
1489 recvPacket.ReadByteSeq(guids[i][5]);
1490 recvPacket.ReadByteSeq(guids[i][6]);
1491 recvPacket.ReadByteSeq(guids[i][7]);
1492 recvPacket.ReadByteSeq(guids[i][0]);
1493 recvPacket.ReadByteSeq(guids[i][1]);
1494 recvPacket.ReadByteSeq(guids[i][3]);
1495 recvPacket.ReadByteSeq(guids[i][4]);
1496 recvPacket >> entry;
1497 recvPacket.ReadByteSeq(guids[i][2]);
1498
1499 switch (type)
1500 {
1501 case DB2_REPLY_ITEM:
1502 sendItemDb2Reply(entry);
1503 break;
1504 case DB2_REPLY_SPARSE:
1506 break;
1507 default:
1508 sLogger.debug("Received unknown hotfix type {}", type);
1509 recvPacket.clear();
1510 break;
1511 }
1512 }
1513#elif VERSION_STRING == Mop
1514 uint32_t type;
1515 recvPacket >> type;
1516
1517 if (type != DB2_REPLY_ITEM && type != DB2_REPLY_SPARSE)
1518 return;
1519
1520 uint32_t count = recvPacket.readBits(21);
1521
1522 auto guids = std::make_unique<ObjectGuid[]>(count);
1523 for (uint32_t i = 0; i < count; ++i)
1524 {
1525 guids[i][6] = recvPacket.readBit();
1526 guids[i][3] = recvPacket.readBit();
1527 guids[i][0] = recvPacket.readBit();
1528 guids[i][1] = recvPacket.readBit();
1529 guids[i][4] = recvPacket.readBit();
1530 guids[i][5] = recvPacket.readBit();
1531 guids[i][7] = recvPacket.readBit();
1532 guids[i][2] = recvPacket.readBit();
1533 }
1534
1535 uint32_t entry;
1536 for (uint32_t i = 0; i < count; ++i)
1537 {
1538 recvPacket.ReadByteSeq(guids[i][1]);
1539 recvPacket >> entry;
1540 recvPacket.ReadByteSeq(guids[i][0]);
1541 recvPacket.ReadByteSeq(guids[i][5]);
1542 recvPacket.ReadByteSeq(guids[i][6]);
1543 recvPacket.ReadByteSeq(guids[i][4]);
1544 recvPacket.ReadByteSeq(guids[i][7]);
1545 recvPacket.ReadByteSeq(guids[i][2]);
1546 recvPacket.ReadByteSeq(guids[i][3]);
1547
1548 /*switch (type)
1549 {
1550 case DB2_REPLY_ITEM:
1551 SendItemDb2Reply(entry);
1552 break;
1553 case DB2_REPLY_SPARSE:
1554 SendItemSparseDb2Reply(entry);
1555 break;
1556 default:
1557 sLogger.debug("Received unknown hotfix type {}", type);
1558 recvPacket.clear();
1559 break;
1560 }*/
1561
1562 WorldPacket data(SMSG_DB_REPLY, 16);
1563 data << uint32_t(entry);
1564 data << uint32_t(time(NULL));
1565 data << uint32_t(type);
1566 data << uint32_t(0);
1567
1568 SendPacket(&data);
1569 }
1570#endif
1571#endif
1572}
#define DB2_REPLY_ITEM
#define DB2_REPLY_SPARSE
@ SMSG_DB_REPLY
Definition Opcodes.hpp:1608
void sendItemDb2Reply(uint32_t entry)
void sendItemSparseDb2Reply(uint32_t entry)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRequestPvpOptionsOpcode()

void WorldSession::handleRequestPvpOptionsOpcode ( WorldPacket )
protected

Definition at line 346 of file BattlegroundHandler.cpp.

347{
348#if VERSION_STRING >= Cata
349 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REQUEST_RATED_BG_STATS received");
350
351 SendPacket(SmsgPvpOptionsEnabled(true, true, true).serialise().get());
352#endif
353}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRequestPvPRewardsOpcode()

void WorldSession::handleRequestPvPRewardsOpcode ( WorldPacket )
protected

Definition at line 329 of file BattlegroundHandler.cpp.

330{
331#if VERSION_STRING >= Cata
332 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REQUEST_RATED_BG_STATS received");
333
335 packet << uint32_t(0); // unknown currency week cap conquest points
336 packet << uint32_t(0); // unknown currency on week conquest points
337 packet << uint32_t(0); // unknown currency week cap conquest arena
338 packet << uint32_t(0); // unknown currency on week conquest random baattleground
339 packet << uint32_t(0); // unknown currency on week conquest arena
340 packet << uint32_t(0); // unknown currency week cap conquest points
341
342 SendPacket(&packet);
343#endif
344}
@ SMSG_REQUEST_PVP_REWARDS_RESPONSE
Definition Opcodes.hpp:1717
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRequestRaidInfoOpcode()

void WorldSession::handleRequestRaidInfoOpcode ( WorldPacket )
private

Definition at line 785 of file GroupHandler.cpp.

786{
788}
void sendRaidInfo()
Definition Player.cpp:12927
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRequestRatedBgInfoOpcode()

void WorldSession::handleRequestRatedBgInfoOpcode ( WorldPacket recvPacket)
protected

Definition at line 307 of file BattlegroundHandler.cpp.

308{
309#if VERSION_STRING >= Cata
310 CmsgRequestRatedBgInfo srlPacket;
311 if (!srlPacket.deserialise(recvPacket))
312 return;
313
314 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REQUEST_RATED_BG_INFO received with unk_type = {}", srlPacket.type);
315
316 SendPacket(SmsgRatedBgInfo(0).serialise().get());
317#endif
318}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRequestRatedBgStatsOpcode()

void WorldSession::handleRequestRatedBgStatsOpcode ( WorldPacket )
protected

Definition at line 320 of file BattlegroundHandler.cpp.

321{
322#if VERSION_STRING >= Cata
323 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_REQUEST_RATED_BG_STATS received");
324
325 SendPacket(SmsgRatedBgStats(3).serialise().get());
326#endif
327}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRequestVehicleNextSeat()

void WorldSession::handleRequestVehicleNextSeat ( WorldPacket recvPacket)
protected

Definition at line 55 of file VehicleHandler.cpp.

56{
57#if VERSION_STRING > TBC
58 if (GetPlayer()->getVehicleBase() == nullptr)
59 {
60 recvPacket.rfinish();
61 return;
62 }
63
64 auto seat = GetPlayer()->getVehicle()->getSeatForPassenger(GetPlayer());
65 if (!seat->canSwitchFromSeat())
66 {
67 recvPacket.rfinish();
68 return;
69 }
70
71 GetPlayer()->callChangeSeat(-1, true);
72#endif
73}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRequestVehiclePreviousSeat()

void WorldSession::handleRequestVehiclePreviousSeat ( WorldPacket recvPacket)
protected

Definition at line 35 of file VehicleHandler.cpp.

36{
37#if VERSION_STRING > TBC
38 if (GetPlayer()->getVehicleBase() == nullptr)
39 {
40 recvPacket.rfinish();
41 return;
42 }
43
44 auto seat = GetPlayer()->getVehicle()->getSeatForPassenger(GetPlayer());
45 if (!seat->canSwitchFromSeat())
46 {
47 recvPacket.rfinish();
48 return;
49 }
50
51 GetPlayer()->callChangeSeat(-1, false);
52#endif
53}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleRequestVehicleSwitchSeat()

void WorldSession::handleRequestVehicleSwitchSeat ( WorldPacket recvPacket)
protected

Definition at line 75 of file VehicleHandler.cpp.

76{
77#if VERSION_STRING > TBC
78 Unit* vehicle_base = GetPlayer()->getVehicleBase();
79 if (!vehicle_base)
80 return;
81
82 if (auto seat = GetPlayer()->getVehicle()->getSeatForPassenger(GetPlayer()))
83 if (!seat->canSwitchFromSeat())
84 return;
85
86 WoWGuid guid;
87 int8_t seatId;
88
89 recvPacket >> guid;
90 recvPacket >> seatId;
91
92 if (vehicle_base->getGuid() == guid.getRawGuid())
93 {
94 GetPlayer()->callChangeSeat(seatId);
95 }
96 else if (Unit* vehUnit = GetPlayer()->getWorldMap()->getUnit(guid.getRawGuid()))
97 {
98 if (Vehicle* vehicle = vehUnit->getVehicleKit())
99 {
100 if (vehicle->hasEmptySeat(seatId))
101 {
102 vehUnit->handleSpellClick(GetPlayer(), seatId);
103 }
104 }
105 }
106#endif
107}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleResetInstanceOpcode()

void WorldSession::handleResetInstanceOpcode ( WorldPacket )
protected

Definition at line 731 of file MiscHandler.cpp.

732{
733 if (const auto group = _player->getGroup())
734 {
735 if (group->GetLeader()->guid == _player->getGuidLow())
736 group->resetInstances(INSTANCE_RESET_ALL, false, _player);
737 }
738 else
739 {
741 }
742}
@ INSTANCE_RESET_ALL
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleResurrectResponse()

void WorldSession::handleResurrectResponse ( WorldPacket recvPacket)
protected

Definition at line 776 of file MiscHandler.cpp.

777{
778 CmsgResurrectResponse srlPacket;
779 if (!srlPacket.deserialise(recvPacket))
780 return;
781
782 if (!_player->isAlive())
783 return;
784
785 auto player = _player->getWorldMap()->getPlayer(srlPacket.guid.getGuidLow());
786 if (player == nullptr)
787 player = sObjectMgr.getPlayer(srlPacket.guid.getGuidLow());
788
789 if (player == nullptr)
790 return;
791
792 if (srlPacket.status != 1 || _player->m_resurrecter || _player->m_resurrecter != srlPacket.guid.getRawGuid())
793 {
797 return;
798 }
799
801 _player->setMoveRoot(false);
802}
uint64_t m_resurrecter
Definition Player.hpp:1216
uint32_t m_resurrectHealth
Definition Player.hpp:1217
uint32_t m_resurrectMana
Definition Player.hpp:1218
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleReturnToGraveyardOpcode()

void WorldSession::handleReturnToGraveyardOpcode ( WorldPacket )
protected

Definition at line 1040 of file MiscHandler.cpp.

1041{
1042#if VERSION_STRING >= Cata
1043 if (_player->isAlive())
1044 return;
1045
1047#endif
1048}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleReturnToSenderOpcode()

void WorldSession::handleReturnToSenderOpcode ( WorldPacket recvPacket)
protected

Definition at line 98 of file MailHandler.cpp.

99{
100 CmsgMailReturnToSender srlPacket;
101 if (!srlPacket.deserialise(recvPacket))
102 return;
103
104 const auto mailMessage = _player->m_mailBox->GetMessageById(srlPacket.messageId);
105 if (mailMessage == nullptr)
106 {
108 return;
109 }
110
111 auto message = *mailMessage;
112
113 _player->m_mailBox->DeleteMessage(srlPacket.messageId, true);
114
115 message.player_guid = message.sender_guid;
116 message.sender_guid = _player->getGuid();
117
118 message.deleted_flag = false;
119 message.checked_flag = MAIL_CHECK_MASK_RETURNED;
120
121 message.cod = 0;
122
123 message.delivery_time = message.items.empty() ? static_cast<uint32_t>(UNIXTIME) : static_cast<uint32_t>(UNIXTIME) + HOUR;
124
125 sMailSystem.DeliverMessage(message.player_guid, &message);
126
128}
@ MAIL_CHECK_MASK_RETURNED
Definition MailMgr.h:101
@ MAIL_RES_RETURNED_TO_SENDER
Definition MailMgr.h:39
@ HOUR
Definition Definitions.h:13
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSaveGuildEmblem()

void WorldSession::handleSaveGuildEmblem ( WorldPacket recvPacket)
private

Definition at line 111 of file GuildHandler.cpp.

112{
113 MsgSaveGuildEmblem srlPacket;
114 if (!srlPacket.deserialise(recvPacket))
115 return;
116
117 sLogger.debug("MSG_SAVE_GUILD_EMBLEM {}: vendorGuid: {} style: {}, color: {}, borderStyle: {}, borderColor: {}, backgroundColor: {}",
118 _player->getName(), srlPacket.guid.getGuidLow(), srlPacket.emblemInfo.getStyle(), srlPacket.emblemInfo.getColor(),
120
121 Guild* guild = _player->getGuild();
122 if (guild == nullptr)
123 {
125 return;
126 }
127
128 if (guild->getLeaderGUID() != _player->getGuid())
129 {
131 return;
132 }
133
134 guild->handleSetEmblem(this, srlPacket.emblemInfo);
135}
@ GEM_ERROR_NOTGUILDMASTER
@ GEM_ERROR_NOGUILD
uint64_t getLeaderGUID() const
Definition Guild.hpp:48
void handleSetEmblem(WorldSession *session, const EmblemInfo &emblemInfo)
Definition Guild.cpp:519
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSelfResurrect()

void WorldSession::handleSelfResurrect ( WorldPacket )
protected

Definition at line 804 of file MiscHandler.cpp.

805{
806 if (const auto resurrectSpell = _player->getSelfResurrectSpell())
807 {
808 const auto spellInfo = sSpellMgr.getSpellInfo(resurrectSpell);
809 if (const auto spell = sSpellMgr.newSpell(_player, spellInfo, true, nullptr))
810 {
811 SpellCastTargets spellCastTargets(_player->getGuid());
812 spell->prepare(&spellCastTargets);
813 }
814 }
815}
uint32_t getSelfResurrectSpell() const
Definition Player.cpp:1135
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSellItemOpcode()

void WorldSession::handleSellItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 1857 of file ItemHandler.cpp.

1858{
1859 CmsgSellItem srlPacket;
1860 if (!srlPacket.deserialise(recvPacket))
1861 return;
1862
1863 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_SELL_ITEM");
1864
1866
1867 // Check if item exists
1868 if (!srlPacket.itemGuid)
1869 {
1870 sendSellItem(srlPacket.vendorGuid.getRawGuid(), srlPacket.itemGuid, 1);
1871 return;
1872 }
1873
1875 // Check if Vendor exists
1876 if (unit == nullptr)
1877 {
1878 sendSellItem(srlPacket.vendorGuid.getRawGuid(), srlPacket.itemGuid, 3);
1879 return;
1880 }
1881
1882 Item* item = _player->getItemInterface()->GetItemByGUID(srlPacket.itemGuid);
1883 if (!item)
1884 {
1885 sendSellItem(srlPacket.vendorGuid.getRawGuid(), srlPacket.itemGuid, 1);
1886 return; //our player doesn't have this item
1887 }
1888
1889 ItemProperties const* it = item->getItemProperties();
1890
1891 if (item->isContainer() && dynamic_cast<Container*>(item)->hasItems())
1892 {
1893 sendSellItem(srlPacket.vendorGuid.getRawGuid(), srlPacket.itemGuid, 6);
1894 return;
1895 }
1896
1897 // Check if item can be sold
1898 if (it->SellPrice == 0 || item->m_wrappedItemId != 0)
1899 {
1900 sendSellItem(srlPacket.vendorGuid.getRawGuid(), srlPacket.itemGuid, 2);
1901 return;
1902 }
1903
1904 uint32_t stackcount = item->getStackCount();
1905 uint32_t quantity = 0;
1906
1907 if (srlPacket.amount != 0)
1908 quantity = srlPacket.amount;
1909 else
1910 quantity = stackcount; //allitems
1911
1912 if (quantity > stackcount)
1913 quantity = stackcount; //make sure we don't over do it
1914
1915 uint32_t price = item->getSellPrice(quantity);
1916
1917 // Check they don't have more than the max gold
1918 if (worldConfig.player.isGoldCapEnabled)
1919 {
1920 if (_player->getCoinage() + price > worldConfig.player.limitGoldAmount)
1921 {
1923 return;
1924 }
1925 }
1926
1927 _player->modCoinage(price);
1928
1929 if (quantity < stackcount)
1930 {
1931 item->setStackCount(stackcount - quantity);
1932 item->m_isDirty = true;
1933 }
1934 else
1935 {
1936 //removing the item from the char's inventory
1937 //again to remove item from slot
1938 auto itemHolder = _player->getItemInterface()->SafeRemoveAndRetreiveItemByGuid(srlPacket.itemGuid, false);
1939 if (itemHolder)
1940 {
1941 itemHolder->deleteFromDB();
1942 _player->getItemInterface()->AddBuyBackItem(std::move(itemHolder), it->SellPrice * quantity);
1943 }
1944 }
1945
1946 SendPacket(SmsgSellItem(srlPacket.vendorGuid.getRawGuid(), srlPacket.itemGuid).serialise().get());
1947}
void AddBuyBackItem(std::unique_ptr< Item > it, uint32_t price)
uint32_t m_wrappedItemId
Definition Item.hpp:260
uint32_t getSellPrice(uint32_t count)
Definition Item.cpp:1508
void sendSellItem(uint64_t vendorguid, uint64_t itemid, uint8_t error)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSendMailOpcode()

void WorldSession::handleSendMailOpcode ( WorldPacket recvPacket)
protected

Definition at line 443 of file MailHandler.cpp.

444{
445 CmsgSendMail srlPacket;
446 if (!srlPacket.deserialise(recvPacket))
447 {
449 return;
450 }
451
452 if (srlPacket.itemCount > MAIL_MAX_ITEM_SLOT)
453 {
455 return;
456 }
457
458 const auto playerReceiverInfo = sObjectMgr.getCachedCharacterInfoByName(srlPacket.receiverName);
459 if (playerReceiverInfo == nullptr)
460 {
462 return;
463 }
464
465 std::vector<Item*> attachedItems;
466 for (uint8_t i = 0; i < srlPacket.itemCount; ++i)
467 {
468 Item* pItem = _player->getItemInterface()->GetItemByGUID(srlPacket.itemGuid[i]);
469 if (pItem == nullptr || pItem->isSoulbound() || pItem->hasFlags(ITEM_FLAG_CONJURED))
470 {
472 return;
473 }
474
475 if (pItem->isAccountbound() && GetAccountId() != playerReceiverInfo->acct)
476 {
478 return;
479 }
480 attachedItems.push_back(pItem);
481 }
482
483 bool isInterfactionMailAllowed = false;
485 {
486 isInterfactionMailAllowed = true;
487 }
488
489 if (playerReceiverInfo->team != _player->getTeam() && !isInterfactionMailAllowed)
490 {
492 return;
493 }
494
495 if (playerReceiverInfo->name == _player->getName() && !hasPermissions())
496 {
498 return;
499 }
500
501 if (srlPacket.stationery == MAIL_STATIONERY_GM && !HasGMPermissions())
502 {
504 return;
505 }
506
507 // calculate cost
508 uint32_t cost = 0;
509 if (srlPacket.money > 0)
510 cost += static_cast<uint32_t>(srlPacket.money); // \todo Change gold functions to uint64_t
511
513 cost += srlPacket.itemCount ? 30 * srlPacket.itemCount : 30;
514
515 if (!_player->hasEnoughCoinage(cost))
516 {
518 return;
519 }
520
521 // build mail content
522 MailMessage msg;
523
524 if (!attachedItems.empty())
525 {
526 for (auto& item : attachedItems)
527 {
528 auto pItem = _player->getItemInterface()->SafeRemoveAndRetreiveItemByGuid(item->getGuid(), false);
529 if (pItem == nullptr || pItem.get() != item)
530 continue;
531
532 pItem->removeFromWorld();
533 pItem->setOwner(nullptr);
534 pItem->saveToDB(INVENTORY_SLOT_NOT_SET, 0, true, nullptr);
535 msg.items.push_back(pItem->getGuidLow());
536
537 if (hasPermissions())
538 sGMLog.writefromsession(this, "sent mail with item entry %u to %s", pItem->getEntry(), playerReceiverInfo->name.c_str());
539 }
540 }
541
542 msg.delivery_time = static_cast<uint32_t>(UNIXTIME);
543 if (srlPacket.money != 0 || srlPacket.cod != 0 || attachedItems.empty() && playerReceiverInfo->acct != _player->getSession()->GetAccountId())
544 {
546 msg.delivery_time += HOUR;
547 }
548
549 msg.player_guid = playerReceiverInfo->guid;
550 msg.sender_guid = _player->getGuid();
551 msg.stationery = srlPacket.stationery;
552 msg.money = static_cast<uint32_t>(srlPacket.money);
553 msg.cod = static_cast<uint32_t>(srlPacket.cod);
554 msg.subject = srlPacket.subject;
555 msg.body = srlPacket.body;
556
557 if (!sMailSystem.MailOption(MAIL_FLAG_NO_EXPIRY))
558 msg.expire_time = static_cast<uint32_t>(UNIXTIME) + (TimeVars::Day * MAIL_DEFAULT_EXPIRATION_TIME);
559 else
560 msg.expire_time = 0;
561
562 msg.deleted_flag = false;
563 msg.message_type = 0;
565
566 sMailSystem.DeliverMessage(playerReceiverInfo->guid, &msg);
567
568 // charge and save gold
569 _player->modCoinage(-static_cast<int32_t>(cost));
570
571 CharacterDatabase.Execute("UPDATE characters SET gold = %u WHERE guid = %u", _player->getCoinage(), _player->m_playerInfo->guid);
572
574}
@ ITEM_FLAG_CONJURED
@ INV_ERR_ARTEFACTS_ONLY_FOR_OWN_CHARACTERS
@ MAIL_CHECK_MASK_HAS_BODY
Definition MailMgr.h:104
@ MAIL_CHECK_MASK_COPIED
Definition MailMgr.h:102
#define MAIL_MAX_ITEM_SLOT
Definition MailMgr.h:25
@ MAIL_FLAG_NO_COST_FOR_GM
Definition MailMgr.h:46
@ MAIL_FLAG_DISABLE_POSTAGE_COSTS
Definition MailMgr.h:49
@ MAIL_FLAG_DISABLE_HOUR_DELAY_FOR_ITEMS
Definition MailMgr.h:50
@ MAIL_FLAG_CAN_SEND_TO_OPPOSITE_FACTION
Definition MailMgr.h:47
@ MAIL_FLAG_CAN_SEND_TO_OPPOSITE_FACTION_GM
Definition MailMgr.h:48
@ MAIL_STATIONERY_GM
Definition MailMgr.h:88
@ MAIL_RES_MAIL_SENT
Definition MailMgr.h:36
@ MAIL_ERR_NOT_YOUR_ALLIANCE
Definition MailMgr.h:71
@ MAIL_ERR_NOT_ENOUGH_MONEY
Definition MailMgr.h:69
@ MAIL_ERR_RECIPIENT_NOT_FOUND
Definition MailMgr.h:70
@ MAIL_ERR_BAG_FULL
Definition MailMgr.h:67
@ MAIL_ERR_TOO_MANY_ATTACHMENTS
Definition MailMgr.h:77
@ MAIL_ERR_CANNOT_SEND_TO_SELF
Definition MailMgr.h:68
#define MAIL_DEFAULT_EXPIRATION_TIME
Definition MailMgr.h:26
#define sGMLog
void removeFromWorld()
Definition Item.cpp:1514
void saveToDB(int8_t containerslot, int8_t slot, bool firstsave, QueryBuffer *buf)
Definition Item.cpp:1338
bool isAccountbound() const
Definition Item.hpp:219
void setOwner(Player *owner)
Definition Item.cpp:946
uint32_t money
Definition MailMgr.h:115
uint32_t checked_flag
Definition MailMgr.h:121
uint64_t sender_guid
Definition MailMgr.h:112
std::vector< uint32_t > items
Definition MailMgr.h:116
uint64_t player_guid
Definition MailMgr.h:111
uint32_t expire_time
Definition MailMgr.h:119
std::string body
Definition MailMgr.h:114
bool deleted_flag
Definition MailMgr.h:122
uint32_t cod
Definition MailMgr.h:117
uint32_t stationery
Definition MailMgr.h:118
std::string subject
Definition MailMgr.h:113
uint32_t delivery_time
Definition MailMgr.h:120
uint32_t message_type
Definition MailMgr.h:110
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetActionBarTogglesOpcode()

void WorldSession::handleSetActionBarTogglesOpcode ( WorldPacket recvPacket)
protected

Definition at line 564 of file MiscHandler.cpp.

565{
566 CmsgSetActionbarToggles srlPacket;
567 if (!srlPacket.deserialise(recvPacket))
568 return;
569
570 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_SET_ACTIONBAR_TOGGLES: {} (actionbarId)", srlPacket.actionbarId);
571
573}
void setEnabledActionBars(uint8_t actionBarId)
Definition Player.cpp:1235
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetActionButtonOpcode()

void WorldSession::handleSetActionButtonOpcode ( WorldPacket recvPacket)
protected

Definition at line 365 of file MiscHandler.cpp.

366{
367 CmsgSetActionButton srlPacket;
368 if (!srlPacket.deserialise(recvPacket))
369 return;
370
371 sLogger.debug("BUTTON: {} ACTION: {} TYPE: {} MISC: {}", srlPacket.button, srlPacket.action, srlPacket.type, srlPacket.misc);
372
373 if (srlPacket.action == 0)
374 {
375 sLogger.debug("MISC: Remove action from button {}", srlPacket.button);
376 _player->setActionButton(srlPacket.button, 0, 0, 0);
377 }
378 else
379 {
380 if (srlPacket.button >= PLAYER_ACTION_BUTTON_COUNT)
381 return;
382
383 if (srlPacket.type == 64 || srlPacket.type == 65)
384 {
385 sLogger.debug("MISC: Added Macro {} into button {}", srlPacket.action, srlPacket.button);
386 _player->setActionButton(srlPacket.button, srlPacket.action, srlPacket.type, srlPacket.misc);
387 }
388 else if (srlPacket.type == 128)
389 {
390 sLogger.debug("MISC: Added Item {} into button {}", srlPacket.action, srlPacket.button);
391 _player->setActionButton(srlPacket.button, srlPacket.action, srlPacket.type, srlPacket.misc);
392 }
393 else if (srlPacket.type == 0)
394 {
395 sLogger.debug("MISC: Added Spell {} into button {}", srlPacket.action, srlPacket.button);
396 _player->setActionButton(srlPacket.button, srlPacket.action, srlPacket.type, srlPacket.misc);
397 }
398 }
399}
#define PLAYER_ACTION_BUTTON_COUNT
void setActionButton(uint8_t button, uint32_t action, uint8_t type, uint8_t misc)
Definition Player.cpp:6374
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetActiveMoverOpcode()

void WorldSession::handleSetActiveMoverOpcode ( WorldPacket recvPacket)
protected

Definition at line 34 of file MovementHandler.cpp.

35{
36#if VERSION_STRING < Cata
37 CmsgSetActiveMover srlPacket;
38 if (!srlPacket.deserialise(recvPacket))
39 return;
40
41 if (srlPacket.guid == m_MoverWoWGuid.getRawGuid())
42 return;
43
44#if VERSION_STRING > TBC
45 if (_player->getCharmGuid() != srlPacket.guid.getRawGuid() || _player->getGuid() != srlPacket.guid.getRawGuid())
46 {
47 auto bad_packet = true;
48 if (const auto vehicle = _player->getVehicle())
49 if (const auto owner = vehicle->getBase())
50 if (owner->getGuid() == srlPacket.guid.getRawGuid())
51 bad_packet = false;
52
53 if (bad_packet)
54 return;
55 }
56#endif
57
58 if (srlPacket.guid.getRawGuid() == 0)
60 else
61 m_MoverWoWGuid = srlPacket.guid;
62#endif
63}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetAutoLootPassOpcode()

void WorldSession::handleSetAutoLootPassOpcode ( WorldPacket recvPacket)
protected

Definition at line 553 of file MiscHandler.cpp.

554{
555 CmsgOptOutOfLoot srlPacket;
556 if (!srlPacket.deserialise(recvPacket))
557 return;
558
559 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_OPT_OUT_OF_LOOT: {} (turnedOn)", srlPacket.turnedOn);
560
561 _player->m_passOnLoot = srlPacket.turnedOn > 0 ? true : false;
562}
bool m_passOnLoot
Definition Player.hpp:2230
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetFactionAtWarOpcode()

void WorldSession::handleSetFactionAtWarOpcode ( WorldPacket recvPacket)
protected

Definition at line 79 of file CharacterHandler.cpp.

80{
81 CmsgSetFactionAtWar srlPacket;
82 if (!srlPacket.deserialise(recvPacket))
83 return;
84
85 _player->setFactionAtWar(srlPacket.id, srlPacket.state == 1);
86}
void setFactionAtWar(uint32_t faction, bool set)
Definition Player.cpp:11558
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetFactionInactiveOpcode()

void WorldSession::handleSetFactionInactiveOpcode ( WorldPacket recvPacket)
protected

Definition at line 88 of file CharacterHandler.cpp.

89{
90 CmsgSetFactionInactive srlPacket;
91 if (!srlPacket.deserialise(recvPacket))
92 return;
93
94 _player->setFactionInactive(srlPacket.id, srlPacket.state == 1);
95}
void setFactionInactive(uint32_t faction, bool set)
Definition Player.cpp:11702
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetFriendNote()

void WorldSession::handleSetFriendNote ( WorldPacket recvPacket)
protected

Definition at line 62 of file SocialHandler.cpp.

63{
64 CmsgSetContactNotes srlPacket;
65 if (!srlPacket.deserialise(recvPacket))
66 return;
67
68 _player->addNoteToFriend(static_cast<uint32_t>(srlPacket.guid), srlPacket.note.size() ? srlPacket.note : "");
69}
void addNoteToFriend(uint32_t guid, std::string note)
Definition Player.cpp:9197
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetGuildBankText()

void WorldSession::handleSetGuildBankText ( WorldPacket recvPacket)
private

Definition at line 202 of file GuildHandler.cpp.

203{
204 CmsgSetGuildBankText srlPacket;
205 if (!srlPacket.deserialise(recvPacket))
206 return;
207
208 if (Guild* guild = _player->getGuild())
209 guild->setBankTabText(srlPacket.tabId, srlPacket.text);
210}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetGuildInfo()

void WorldSession::handleSetGuildInfo ( WorldPacket recvPacket)
private

Definition at line 249 of file GuildHandler.cpp.

250{
251 CmsgGuildInfoText srlPacket;
252 if (!srlPacket.deserialise(recvPacket))
253 return;
254
255 if (Guild* guild = _player->getGuild())
256 guild->handleSetInfo(this, srlPacket.text);
257}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetPlayerDeclinedNamesOpcode()

void WorldSession::handleSetPlayerDeclinedNamesOpcode ( WorldPacket recvPacket)
protected

Definition at line 761 of file CharacterHandler.cpp.

762{
764 if (!srlPacket.deserialise(recvPacket))
765 return;
766
767 //\todo check utf8 and cyrillic chars
768 const uint32_t error = 0; // 0 = success, 1 = error
769
771}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetPlayerIconOpcode()

void WorldSession::handleSetPlayerIconOpcode ( WorldPacket recvPacket)
private

Definition at line 703 of file GroupHandler.cpp.

704{
705 MsgRaidTargetUpdate srlPacket;
706 if (!srlPacket.deserialise(recvPacket))
707 return;
708
709 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_RAID_TARGET_UPDATE: {} (icon)", srlPacket.icon);
710
711 const auto group = _player->getGroup();
712 if (group == nullptr)
713 return;
714
715 if (srlPacket.icon == 0xFF)
716 {
717 SendPacket(MsgRaidTargetUpdate(1, 0, 0, 0, group).serialise().get());
718 }
719 else if (_player->isGroupLeader())
720 {
721 if (srlPacket.icon >= iconCount)
722 return;
723
724 for (uint8_t i = 0; i < iconCount; ++i)
725 {
726 if (group->m_targetIcons[i] == srlPacket.guid)
727 {
728 group->m_targetIcons[i] = 0;
729 group->SendPacketToAll(MsgRaidTargetUpdate(0, 0, i, 0, nullptr).serialise().get());
730 }
731 }
732
733 group->SendPacketToAll(MsgRaidTargetUpdate(0, _player->getGuid(), srlPacket.icon, srlPacket.guid, nullptr).serialise().get());
734 group->m_targetIcons[srlPacket.icon] = srlPacket.guid;
735 }
736}
const uint8_t iconCount
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetSelectionOpcode()

void WorldSession::handleSetSelectionOpcode ( WorldPacket recvPacket)
protected

Definition at line 236 of file MiscHandler.cpp.

237{
238 CmsgSetSelection srlPacket;
239 if (!srlPacket.deserialise(recvPacket))
240 return;
241
242 _player->setTargetGuid(srlPacket.guid);
243
246}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetSheathedOpcode()

void WorldSession::handleSetSheathedOpcode ( WorldPacket recvPacket)
protected

Definition at line 335 of file MiscHandler.cpp.

336{
337 CmsgSetSheathed srlPacket;
338 if (!srlPacket.deserialise(recvPacket))
339 return;
340
341 _player->setSheathType(static_cast<uint8_t>(srlPacket.type));
342}
void setSheathType(uint8_t sheathType)
Definition Unit.cpp:1549
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetTaxiBenchmarkOpcode()

void WorldSession::handleSetTaxiBenchmarkOpcode ( WorldPacket recvPacket)
protected

Definition at line 448 of file MiscHandler.cpp.

449{
450 CmsgSetTaxiBenchmarkMode srlPacket;
451 if (!srlPacket.deserialise(recvPacket))
452 return;
453
454 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_SET_TAXI_BENCHMARK_MODE: {} (mode)", srlPacket.mode);
455}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetTitle()

void WorldSession::handleSetTitle ( WorldPacket recvPacket)
protected

Definition at line 744 of file MiscHandler.cpp.

745{
746 CmsgSetTitle srlPacket;
747 if (!srlPacket.deserialise(recvPacket))
748 return;
749
750#if VERSION_STRING > Classic
751 if (srlPacket.titleId == 0xFFFFFFFF)
752 {
753 _player->setChosenTitle(0);
754 return;
755 }
756
757 if (_player->hasPvPTitle(static_cast<RankTitles>(srlPacket.titleId)))
758 _player->setChosenTitle(srlPacket.titleId);
759#endif
760}
RankTitles
bool hasPvPTitle(RankTitles title)
Definition Player.cpp:8515
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetTradeGold()

void WorldSession::handleSetTradeGold ( WorldPacket recvPacket)
protected

Definition at line 179 of file TradeHandler.cpp.

180{
181#if VERSION_STRING < Cata
182 CmsgSetTradeGold srlPacket;
183 if (!srlPacket.deserialise(recvPacket))
184 return;
185
186 const auto tradeMoney = srlPacket.tradeGoldAmount;
187#else
188 uint64_t tradeMoney;
189 recvPacket >> tradeMoney;
190#endif
191
192 const auto tradeData = _player->getTradeData();
193 if (tradeData == nullptr)
194 return;
195
196 tradeData->setTradeMoney(tradeMoney);
197}
void setTradeMoney(uint64_t money)
Definition TradeData.cpp:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetTradeItem()

void WorldSession::handleSetTradeItem ( WorldPacket recvPacket)
protected

Definition at line 481 of file TradeHandler.cpp.

482{
483 CmsgSetTradeItem srlPacket;
484 if (!srlPacket.deserialise(recvPacket))
485 return;
486
487 const auto tradeData = _player->getTradeData();
488 if (tradeData == nullptr)
489 return;
490
491 if (srlPacket.tradeSlot >= TRADE_SLOT_COUNT)
492 return;
493
494 const auto playerTarget = tradeData->getTradeTarget();
495 if (playerTarget == nullptr)
496 return;
497
498 const auto tradeItem = _player->getItemInterface()->GetInventoryItem(srlPacket.sourceBag, srlPacket.sourceSlot);
499 if (tradeItem == nullptr)
500 return;
501
502 if (srlPacket.tradeSlot < TRADE_SLOT_NONTRADED)
503 {
504 if (tradeItem->isAccountbound())
505 return;
506
507 if (!tradeItem->isTradeableWith(tradeData->getTradeTarget()))
508 {
509 sCheatLog.writefromsession(this, "tried to cheat trade a soulbound item");
510 // not a good idea since we can trade soulbound items if item flag is set.
511 // Would Disconnect the Trader when the Trader is not on the allowedGuids list.
512 //Disconnect();
513 return;
514 }
515 }
516
517 if (tradeItem->isContainer())
518 {
519 const auto container = dynamic_cast<Container*>(tradeItem);
520 if (container != nullptr && container->hasItems())
521 {
523 return;
524 }
525 }
526
527 for (uint8_t i = 0; i < TRADE_SLOT_COUNT; ++i)
528 {
529 if (tradeData->getTradeItem(TradeSlots(i)) == tradeItem || playerTarget->getTradeData()->getTradeItem(TradeSlots(i)) == tradeItem)
530 {
531 sCheatLog.writefromsession(this, "tried to dupe an item through trade");
532 Disconnect();
533 return;
534 }
535 }
536
538 {
539 const auto item = _player->getItemInterface()->GetInventoryItem(srlPacket.sourceBag);
540 if (item == nullptr || srlPacket.sourceSlot >= item->getItemProperties()->ContainerSlots)
541 {
542 sCheatLog.writefromsession(this, "tried to cheat trade a soulbound item");
543 Disconnect();
544 }
545 }
546
547 tradeData->setTradeItem(TradeSlots(srlPacket.tradeSlot), tradeItem);
548}
@ INVENTORY_SLOT_BAG_START
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSetWatchedFactionIndexOpcode()

void WorldSession::handleSetWatchedFactionIndexOpcode ( WorldPacket recvPacket)
protected

Definition at line 401 of file MiscHandler.cpp.

402{
403 CmsgSetWatchedFaction srlPacket;
404 if (!srlPacket.deserialise(recvPacket))
405 return;
406
408}
void setWatchedFaction(uint32_t factionId)
Definition Player.cpp:1139
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSpellClick()

void WorldSession::handleSpellClick ( WorldPacket recvPacket)
protected

Definition at line 28 of file SpellHandler.cpp.

29{
30 if (!_player->isAlive())
31 return;
32
33 // The guid of the unit we clicked
34 uint64_t unitGuid;
35 recvPacket >> unitGuid;
36
37 Unit* unitTarget = _player->getWorldMap()->getUnit(unitGuid);
38 if (!unitTarget || !unitTarget->IsInWorld() || !unitTarget->isCreature())
39 return;
40
41 if (!_player->isInRange(unitTarget, MAX_INTERACTION_RANGE))
42 return;
43
44 unitTarget->handleSpellClick(_player);
45
46 // TODO: move this Lightwell 'script' to SpellScript or CreatureScript...
47 // For future reference; seems like the Lightwell npc should actually cast spell 60123 on click
48 // and this 60123 spell has Script Effect, where should be determined which rank of the Lightwell Renew needs to be casted (switch (GetCaster()->getCreatedBySpellId())...)
49
50 // Commented this out for now, it's not even working -Appled
51 /*const uint32_t lightWellCharges = 59907;
52 if (creatureTarget->removeAllAurasById(lightWellCharges))
53 {
54 uint32_t lightWellRenew[] =
55 {
56 7001,
57 27873,
58 27874,
59 28276,
60 48084,
61 48085,
62 0
63 };
64
65 if (!_player->hasAurasWithId(lightWellRenew))
66 {
67 if (SpellClickSpell const* clickSpell = sMySQLStore.getSpellClickSpell(creatureTarget->getEntry()))
68 {
69 creatureTarget->castSpell(_player, clickSpell->SpellID, true);
70 }
71 else
72 {
73 sChatHandler.BlueSystemMessage(this, "NPC Id %u (%s) has no spellclick spell associated with it.", creatureTarget->GetCreatureProperties()->Id, creatureTarget->GetCreatureProperties()->Name.c_str());
74 sLogger.failure("Spellclick packet received for creature {} but there is no spell associated with it.", creatureTarget->getEntry());
75 return;
76 }
77
78 if (!creatureTarget->hasAurasWithId(lightWellCharges))
79 {
80 creatureTarget->Despawn(0, 0);
81 }
82 return;
83 }
84 }*/
85}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSpiritHealerActivateOpcode()

void WorldSession::handleSpiritHealerActivateOpcode ( WorldPacket )
protected

Definition at line 573 of file NPCHandler.cpp.

574{
575 if (!_player->isDead())
576 return;
577
580
581 if (_player->getLevel() > 10)
582 {
583 const auto aura = _player->getAuraWithId(15007);
584 if (aura == nullptr)
585 {
586 const auto spellInfo = sSpellMgr.getSpellInfo(15007);
587 SpellCastTargets targets(_player->getGuid());
588 const auto spell = sSpellMgr.newSpell(_player, spellInfo, true, nullptr);
589 spell->prepare(&targets);
590 }
591
592 uint32_t duration = 600000;
593
594 if (_player->getLevel() < 20)
595 duration = (_player->getLevel() - 10) * 60000;
596
597 if (const auto aur = _player->getAuraWithId(15007))
598 aur->setNewMaxDuration(duration);
599 }
600
602}
SpellInfo const * getSpellInfo() const
void calcDeathDurabilityLoss(double percent)
Definition Player.cpp:7747
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSplitOpcode()

void WorldSession::handleSplitOpcode ( WorldPacket recvPacket)
protected

Definition at line 868 of file ItemHandler.cpp.

869{
870 CmsgSplitItem srlPacket;
871 if (!srlPacket.deserialise(recvPacket))
872 return;
873
874 if (srlPacket.itemCount <= 0 || srlPacket.srcInventorySlot <= 0 && srlPacket.srcSlot < INVENTORY_SLOT_ITEM_START)
875 {
876 sCheatLog.writefromsession(this,
877 "tried to split item: srcInventorySlot %d, srcSlot %d, destInventorySlot %d, destSlot %d, itemCount %ld",
878 srlPacket.srcInventorySlot, srlPacket.srcSlot, srlPacket.destInventorySlot, srlPacket.destSlot, srlPacket.itemCount);
879 return;
880 }
881
882 if (!VerifyBagSlots(srlPacket.srcInventorySlot, srlPacket.srcSlot))
883 return;
884
885 if (!VerifyBagSlots(srlPacket.destInventorySlot, srlPacket.destSlot))
886 return;
887
888 uint32_t count = srlPacket.itemCount;
889
890 auto inventoryItem1 = _player->getItemInterface()->GetInventoryItem(srlPacket.srcInventorySlot, srlPacket.srcSlot);
891 if (!inventoryItem1)
892 return;
893
894 auto inventoryItem2 = _player->getItemInterface()->GetInventoryItem(srlPacket.destInventorySlot, srlPacket.destSlot);
895
896 const uint32_t itemMaxStack1 = inventoryItem1->getOwner()->m_cheats.hasItemStackCheat ? 0x7fffffff : inventoryItem1->getItemProperties()->MaxCount;
897 const uint32_t itemMaxStack2 = inventoryItem2 ? (inventoryItem2->getOwner()->m_cheats.hasItemStackCheat
898 ? 0x7fffffff : inventoryItem2->getItemProperties()->MaxCount) : 0;
899 if (inventoryItem1->m_wrappedItemId || inventoryItem2 && inventoryItem2->m_wrappedItemId || count > itemMaxStack1)
900 {
902 return;
903 }
904
905 // something already in this slot
906 if (inventoryItem2)
907 {
908 if (inventoryItem1->getEntry() == inventoryItem2->getEntry())
909 {
910 //check if player has the required stacks to avoid exploiting.
911 //safe exploit check
912 if (count < inventoryItem1->getStackCount())
913 {
914 //check if there is room on the other item.
915 if (count + inventoryItem2->getStackCount() <= itemMaxStack2)
916 {
917 inventoryItem1->modStackCount(-srlPacket.itemCount);
918 inventoryItem2->modStackCount(count);
919 inventoryItem1->m_isDirty = true;
920 inventoryItem2->m_isDirty = true;
921 }
922 else
923 {
925 }
926 }
927 else
928 {
930 }
931 }
932 else
933 {
935 }
936 }
937 else
938 {
939 if (count < inventoryItem1->getStackCount())
940 {
941 inventoryItem1->modStackCount(-srlPacket.itemCount);
942
943 auto item2Holder = sObjectMgr.createItem(inventoryItem1->getEntry(), _player);
944 if (item2Holder == nullptr)
945 return;
946
947 item2Holder->setStackCount(count);
948 inventoryItem1->m_isDirty = true;
949 item2Holder->m_isDirty = true;
950
951 int8_t DstSlot = srlPacket.destSlot;
952 int8_t DstInvSlot = srlPacket.destInventorySlot;
953
954 if (srlPacket.destSlot == ITEM_NO_SLOT_AVAILABLE)
955 {
957 {
959 if (container != nullptr)
960 DstSlot = container->findFreeSlot();
961 }
962 else
963 {
964 // Find a free slot
965 const auto slotResult = _player->getItemInterface()->FindFreeInventorySlot(item2Holder->getItemProperties());
966 if (slotResult.Result)
967 {
968 DstSlot = slotResult.Slot;
969 DstInvSlot = slotResult.ContainerSlot;
970 }
971 }
972
973 if (DstSlot == ITEM_NO_SLOT_AVAILABLE)
974 {
976 item2Holder->deleteFromDB();
977 item2Holder = nullptr;
978 }
979 }
980
981 const auto [addItemResult, returnedItem] = _player->getItemInterface()->SafeAddItem(std::move(item2Holder), DstInvSlot, DstSlot);
982 if (addItemResult == ADD_ITEM_RESULT_ERROR)
983 {
984 sLogger.failure("Error while adding item to dstslot");
985 if (returnedItem != nullptr)
986 {
987 returnedItem->deleteFromDB();
988 };
989 }
990 }
991 else
992 {
994 }
995 }
996}
@ ADD_ITEM_RESULT_ERROR
@ INV_ERR_COULDNT_SPLIT_ITEMS
bool VerifyBagSlots(int8_t containerSlot, int8_t slot)
Container * GetContainer(int8_t containerSlot)
void deleteFromDB()
Definition Item.cpp:1437
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleStabledPetList()

void WorldSession::handleStabledPetList ( WorldPacket recvPacket)
protected

Definition at line 366 of file NPCHandler.cpp.

367{
368 MsgListStabledPets srlPacket;
369 if (!srlPacket.deserialise(recvPacket))
370 return;
371
372 if (_player->getClass() != HUNTER)
373 {
374 GossipMenu::sendSimpleMenu(srlPacket.guid, 13584, _player);
375 return;
376 }
377
378 sendStabledPetList(srlPacket.guid);
379}
void sendStabledPetList(uint64_t npcguid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleStablePet()

void WorldSession::handleStablePet ( WorldPacket )
protected

Definition at line 242 of file PetHandler.cpp.

243{
244 // Get current pet or first active pet
245 std::optional<uint8_t> petId = std::nullopt;
246 if (const auto* pet = _player->getPet())
247 {
248 if (pet->isHunterPet())
249 petId = pet->getPetId();
250 }
251 else
252 {
253 for (const auto& [slot, id] : _player->getPetCachedSlotMap())
254 {
255 if (slot >= PET_SLOT_MAX_ACTIVE_SLOT)
256 break;
257
258 const auto petCache = _player->getPetCache(id);
259 if (petCache == nullptr || petCache->type != PET_TYPE_HUNTER)
260 continue;
261
262 petId = id;
263 break;
264 }
265 }
266
267 if (!petId.has_value())
268 {
270 return;
271 }
272
273 const auto foundSlot = _player->findFreeStablePetSlot();
274
275 // Check if player has a free stable slot
276 if (!foundSlot.has_value())
277 {
279 return;
280 }
281
282 if (!_player->tryPutPetToSlot(petId.value(), foundSlot.value()))
283 return;
284
286}
@ PET_TYPE_HUNTER
@ PET_SLOT_MAX_ACTIVE_SLOT
PetCache const * getPetCache(uint8_t petId) const
Definition Player.cpp:12276
std::optional< uint8_t > findFreeStablePetSlot() const
Definition Player.cpp:12363
bool tryPutPetToSlot(uint8_t petId, uint8_t newSlot, bool sendErrors=true)
Definition Player.cpp:12380
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleStableSwapPet()

void WorldSession::handleStableSwapPet ( WorldPacket recvPacket)
protected

Definition at line 377 of file PetHandler.cpp.

378{
379 CmsgStableSwapPet srlPacket;
380 if (!srlPacket.deserialise(recvPacket))
381 return;
382
383 // Pet number in packet is always the pet that is in stables
385}
static void performStableSlotSwap(Player *player, uint8_t petNumber)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleStandStateChangeOpcode()

void WorldSession::handleStandStateChangeOpcode ( WorldPacket recvPacket)
protected

Definition at line 86 of file MiscHandler.cpp.

87{
88 CmsgStandStateChange srlPacket;
89 if (!srlPacket.deserialise(recvPacket))
90 return;
91
92 _player->setStandState(srlPacket.state);
93}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSuggestionOpcode()

void WorldSession::handleSuggestionOpcode ( WorldPacket recvPacket)
protected

Definition at line 1004 of file MiscHandler.cpp.

1005{
1006#if VERSION_STRING >= Cata
1007 uint8_t unk1;
1008 uint8_t unk2;
1009
1010 recvPacket >> unk1;
1011 recvPacket >> unk2;
1012
1013 uint32_t lenght = 0;
1014 lenght = unk1 * 16;
1015 lenght += unk2 / 16;
1016
1017 std::string suggestionMessage;
1018 suggestionMessage = recvPacket.ReadString(lenght);
1019
1020 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_SUGGESTIONS [Suggestion] lenght: {} message: {}", lenght, suggestionMessage);
1021
1022 uint64_t accountId = GetAccountId();
1023 uint32_t timeStamp = uint32_t(UNIXTIME);
1024 uint32_t reportId = sObjectMgr.generateReportId();
1025
1026 std::stringstream ss;
1027
1028 ss << "INSERT INTO playerbugreports VALUES('";
1029 ss << reportId << "','";
1030 ss << accountId << "','";
1031 ss << timeStamp << "',";
1032 ss << "'1',";
1033 ss << "'1','";
1034 ss << CharacterDatabase.EscapeString(suggestionMessage) << "')";
1035
1036 CharacterDatabase.ExecuteNA(ss.str().c_str());
1037#endif
1038}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSummonResponseOpcode()

void WorldSession::handleSummonResponseOpcode ( WorldPacket recvPacket)
protected

Definition at line 1082 of file MiscHandler.cpp.

1083{
1084 CmsgSummonResponse srlPacket;
1085 if (!srlPacket.deserialise(recvPacket))
1086 return;
1087
1088 if (!srlPacket.isClickOn)
1089 return;
1090
1092 {
1093 SendNotification("You do not have permission to perform that function.");
1094 return;
1095 }
1096
1098 return;
1099
1101
1103}
SummonData m_summonData
Definition Player.hpp:1117
uint32_t instanceId
Definition Player.hpp:1114
LocationVector position
Definition Player.hpp:1115
uint32_t summonerId
Definition Player.hpp:1112
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSwapInvItemOpcode()

void WorldSession::handleSwapInvItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 998 of file ItemHandler.cpp.

999{
1000 CmsgSwapInvItem srlPacket;
1001 if (!srlPacket.deserialise(recvPacket))
1002 return;
1003
1004 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_SWAP_INV_ITEM src slot: {} dst slot: {}",
1005 static_cast<uint32_t>(srlPacket.srcSlot), static_cast<uint32_t>(srlPacket.destSlot));
1006
1007 // player trying to add item to the same slot
1008 if (srlPacket.destSlot == srlPacket.srcSlot)
1009 {
1011 return;
1012 }
1013
1014 Item* dstItem = _player->getItemInterface()->GetInventoryItem(srlPacket.destSlot);
1015 Item* srcItem = _player->getItemInterface()->GetInventoryItem(srlPacket.srcSlot);
1016
1017 // allow weapon switching in combat
1018 bool skip_combat = false;
1019 // We're doing an equip swap.
1020 if (srlPacket.srcSlot < EQUIPMENT_SLOT_END || srlPacket.destSlot < EQUIPMENT_SLOT_END)
1021 {
1023 {
1024 // These can't be swapped
1025 if (srlPacket.srcSlot < EQUIPMENT_SLOT_MAINHAND || srlPacket.destSlot < EQUIPMENT_SLOT_MAINHAND)
1026 {
1028 return;
1029 }
1030 skip_combat = true;
1031 }
1032 }
1033
1034 if (!srcItem)
1035 {
1037 return;
1038 }
1039
1040 if (srlPacket.srcSlot == srlPacket.destSlot)
1041 {
1043 return;
1044 }
1045
1046 int8_t error;
1047
1048 if ((error = _player->getItemInterface()->CanEquipItemInSlot2(INVENTORY_SLOT_NOT_SET, srlPacket.destSlot, srcItem, skip_combat, false)) != 0)
1049 {
1050 if (srlPacket.destSlot < INVENTORY_KEYRING_END)
1051 {
1052 _player->getItemInterface()->buildInventoryChangeError(srcItem, dstItem, error);
1053 return;
1054 }
1055 }
1056
1057 if (dstItem != nullptr)
1058 {
1059 if ((error = _player->getItemInterface()->CanEquipItemInSlot2(INVENTORY_SLOT_NOT_SET, srlPacket.srcSlot, dstItem, skip_combat)) != 0)
1060 {
1061 if (srlPacket.srcSlot < INVENTORY_KEYRING_END)
1062 {
1063 const uint32_t reqLevel = dstItem->getItemProperties()->RequiredLevel;
1064 SendPacket(SmsgInventoryChangeFailure(error, srcItem->getGuid(), dstItem->getGuid(), reqLevel, true).serialise().get());
1065 return;
1066 }
1067 }
1068 }
1069
1070 if (srcItem->isContainer())
1071 {
1072 //source has items and dst is a backpack or bank
1073 if (dynamic_cast<Container*>(srcItem)->hasItems())
1074 if (!_player->getItemInterface()->IsBagSlot(srlPacket.destSlot))
1075 {
1077 return;
1078 }
1079
1080 if (dstItem)
1081 {
1082 //source is a bag and dst slot is a bag inventory and has items
1083 if (dstItem->isContainer())
1084 {
1085 if (dynamic_cast<Container*>(dstItem)->hasItems() && !_player->getItemInterface()->IsBagSlot(srlPacket.srcSlot))
1086 {
1088 return;
1089 }
1090 }
1091 else
1092 {
1093 //dst item is not a bag, swap impossible
1095 return;
1096 }
1097 }
1098
1099 //dst is bag inventory
1100 if (srlPacket.destSlot < INVENTORY_SLOT_BAG_END)
1101 {
1102 if (srcItem->getItemProperties()->Bonding == ITEM_BIND_ON_EQUIP)
1103 srcItem->addFlags(ITEM_FLAG_SOULBOUND);
1104 }
1105 }
1106
1107 // swap items
1108 if (_player->isDead())
1109 {
1111 return;
1112 }
1113
1114#if VERSION_STRING > TBC
1115 if (dstItem && srlPacket.srcSlot < INVENTORY_SLOT_BAG_END)
1116 {
1117 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, dstItem->getItemProperties()->ItemId, 0, 0);
1118 if (srlPacket.srcSlot < INVENTORY_SLOT_BAG_START) // check Superior/Epic achievement
1119 {
1120 // Achievement ID:556 description Equip an epic item in every slot with a minimum item level of 213.
1121 // "213" value not found in achievement or criteria entries, have to hard-code it here?
1122 // Achievement ID:557 description Equip a superior item in every slot with a minimum item level of 187.
1123 // "187" value not found in achievement or criteria entries, have to hard-code it here?
1124 if (dstItem->getItemProperties()->Quality == ITEM_QUALITY_RARE_BLUE && dstItem->getItemProperties()->ItemLevel >= 187 ||
1126 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, srlPacket.srcSlot,
1127 dstItem->getItemProperties()->Quality, 0);
1128 }
1129 }
1130 if (srlPacket.destSlot < INVENTORY_SLOT_BAG_END)
1131 {
1132 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, srcItem->getItemProperties()->ItemId, 0, 0);
1133 if (srlPacket.destSlot < INVENTORY_SLOT_BAG_START) // check Superior/Epic achievement
1134 {
1135 // Achievement ID:556 description Equip an epic item in every slot with a minimum item level of 213.
1136 // "213" value not found in achievement or criteria entries, have to hard-code it here?
1137 // Achievement ID:557 description Equip a superior item in every slot with a minimum item level of 187.
1138 // "187" value not found in achievement or criteria entries, have to hard-code it here?
1139 if (srcItem->getItemProperties()->Quality == ITEM_QUALITY_RARE_BLUE && srcItem->getItemProperties()->ItemLevel >= 187 ||
1141 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, srlPacket.destSlot,
1142 srcItem->getItemProperties()->Quality, 0);
1143 }
1144 }
1145#endif
1146
1147 _player->getItemInterface()->SwapItemSlots(srlPacket.srcSlot, srlPacket.destSlot);
1148}
@ INV_ERR_YOU_ARE_DEAD
@ INV_ERR_CANT_DO_IN_COMBAT
@ INV_ERR_ITEMS_CANT_BE_SWAPPED
bool IsBagSlot(int16_t slot)
Checks if the slot is a Bag slot.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleSwapItemOpcode()

void WorldSession::handleSwapItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 379 of file ItemHandler.cpp.

380{
381 CmsgSwapItem srlPacket;
382 if (!srlPacket.deserialise(recvPacket))
383 return;
384
385 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_SWAP_ITEM: destInventorySlot {} destSlot {} srcInventorySlot {} srcInventorySlot {}",
386 srlPacket.destInventorySlot, srlPacket.destSlot, srlPacket.srcInventorySlot, srlPacket.srcSlot);
387
389 srlPacket.destSlot, srlPacket.srcInventorySlot, srlPacket.srcSlot);
390}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTabardVendorActivateOpcode()

void WorldSession::handleTabardVendorActivateOpcode ( WorldPacket recvPacket)
protected

Definition at line 53 of file NPCHandler.cpp.

54{
56 if (!srlPacket.deserialise(recvPacket))
57 return;
58
59 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_TABARDVENDOR_ACTIVATE: {} (guidLowPart)", srlPacket.guid.getGuidLowPart());
60
61 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
62 if (creature == nullptr)
63 return;
64
66}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTakeItemOpcode()

void WorldSession::handleTakeItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 359 of file MailHandler.cpp.

360{
361 CmsgMailTakeItem srlPacket;
362 if (!srlPacket.deserialise(recvPacket))
363 return;
364
365 auto mailMessage = _player->m_mailBox->GetMessageById(srlPacket.messageId);
366 if (mailMessage == nullptr || mailMessage->items.empty())
367 {
369 return;
370 }
371
372 const auto itr = std::find(mailMessage->items.begin(), mailMessage->items.end(), srlPacket.lowGuid);
373 if (itr == mailMessage->items.end())
374 {
376 return;
377 }
378
379 if (mailMessage->cod > 0)
380 {
381 if (!_player->hasEnoughCoinage(mailMessage->cod))
382 {
384 return;
385 }
386 }
387
388 auto itemHolder = sObjectMgr.loadItem(srlPacket.lowGuid);
389 if (itemHolder == nullptr)
390 {
392 return;
393 }
394
395 const auto slotResult = _player->getItemInterface()->FindFreeInventorySlot(itemHolder->getItemProperties());
396 if (slotResult.Result == 0)
397 {
399 return;
400 }
401 itemHolder->m_isDirty = true;
402
403 auto* item = itemHolder.get();
404
405 auto [addResult, returnedItem] = _player->getItemInterface()->SafeAddItem(std::move(itemHolder), slotResult.ContainerSlot, slotResult.Slot);
406 if (!addResult)
407 {
408 const auto [addResult2, _] = _player->getItemInterface()->AddItemToFreeSlot(std::move(returnedItem));
409 if (!addResult2)
410 {
412 return;
413 }
414 }
415 else
416 {
417 item->saveToDB(slotResult.ContainerSlot, slotResult.Slot, true, nullptr);
418 }
419
420 // Remove taken items and update message.
421 mailMessage->items.erase(itr);
422 sMailSystem.SaveMessageToSQL(mailMessage);
423
424 SendPacket(SmsgSendMailResult(srlPacket.messageId, MAIL_RES_ITEM_TAKEN, MAIL_OK, item->getGuidLow(), item->getStackCount()).serialise().get());
425
426 if (mailMessage->cod > 0)
427 {
428 _player->modCoinage(-static_cast<int32_t>(mailMessage->cod));
429 std::string subject = "COD Payment: ";
430 subject += mailMessage->subject;
431
432 const uint64_t answerSender = mailMessage->player_guid;
433 const uint64_t answerReceiver = mailMessage->sender_guid;
434 const uint32_t answerCodMoney = mailMessage->cod;
435
436 sMailSystem.SendAutomatedMessage(MAIL_TYPE_NORMAL, answerSender, answerReceiver, subject, "", answerCodMoney, 0, 0, MAIL_STATIONERY_TEST1, MAIL_CHECK_MASK_COD_PAYMENT);
437
438 mailMessage->cod = 0;
439 CharacterDatabase.Execute("UPDATE mailbox SET cod = 0 WHERE message_id = %u", mailMessage->message_id);
440 }
441}
@ MAIL_CHECK_MASK_COD_PAYMENT
Definition MailMgr.h:103
@ MAIL_STATIONERY_TEST1
Definition MailMgr.h:86
@ MAIL_RES_ITEM_TAKEN
Definition MailMgr.h:38
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTakeMoneyOpcode()

void WorldSession::handleTakeMoneyOpcode ( WorldPacket recvPacket)
protected

Definition at line 68 of file MailHandler.cpp.

69{
70 CmsgMailTakeMoney srlPacket;
71 if (!srlPacket.deserialise(recvPacket))
72 return;
73
74 const auto mailMessage = _player->m_mailBox->GetMessageById(srlPacket.messageId);
75 if (mailMessage == nullptr || !mailMessage->money)
76 {
78 return;
79 }
80
81 if (worldConfig.player.isGoldCapEnabled)
82 {
83 if (_player->getCoinage() + mailMessage->money > worldConfig.player.limitGoldAmount)
84 {
86 return;
87 }
88 }
89
90 _player->modCoinage(mailMessage->money);
91 mailMessage->money = 0;
92
93 CharacterDatabase.WaitExecute("UPDATE mailbox SET money = 0 WHERE message_id = %u", mailMessage->message_id);
94
96}
@ MAIL_RES_MONEY_TAKEN
Definition MailMgr.h:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTaxiNodeStatusQueryOpcode()

void WorldSession::handleTaxiNodeStatusQueryOpcode ( WorldPacket recvPacket)
protected

Definition at line 107 of file TaxiHandler.cpp.

108{
109 CmsgTaxinodeStatusQuery srlPacket;
110 if (!srlPacket.deserialise(recvPacket))
111 return;
112
113 sLogger.debug("WORLD: Received CMSG_TAXINODE_STATUS_QUERY");
114
115 sendTaxiStatus(WoWGuid(srlPacket.guid));
116}
void sendTaxiStatus(WoWGuid guid)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTaxiQueryAvaibleNodesOpcode()

void WorldSession::handleTaxiQueryAvaibleNodesOpcode ( WorldPacket recvPacket)
protected

Definition at line 118 of file TaxiHandler.cpp.

119{
121 if (!srlPacket.deserialise(recvPacket))
122 return;
123
124 sLogger.debug("WORLD: Received CMSG_TAXIQUERYAVAILABLENODES");
125
126 // cheating checks
128 if (!unit)
129 {
131 return;
132 }
133
134 // remove fake death
135 if (GetPlayer()->hasUnitStateFlag(UNIT_STATE_DIED))
137
138 // unknown taxi node case
139 if (sendLearnNewTaxiNode(unit))
140 return;
141
142 // known taxi node case
143 sendTaxiMenu(unit);
144}
@ SPELL_AURA_FEIGN_DEATH
@ UNIT_STATE_DIED
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTextEmoteOpcode()

void WorldSession::handleTextEmoteOpcode ( WorldPacket recvPacket)
protected

Definition at line 461 of file ChatHandler.cpp.

462{
463 if (!_player->isAlive())
464 return;
465
466 CmsgTextEmote srlPacket;
467 if (!srlPacket.deserialise(recvPacket))
468 return;
469
471 return;
472
473 const char* unitName = " ";
474 uint32_t nameLength = 1;
475
476 Unit* unit = _player->getWorldMap()->getUnit(srlPacket.guid);
477 if (unit)
478 {
479 if (unit->isPlayer())
480 {
481 unitName = dynamic_cast<Player*>(unit)->getName().c_str();
482 nameLength = static_cast<uint32_t>(strlen(unitName)) + 1;
483 }
484 else if (unit->isPet())
485 {
486 unitName = dynamic_cast<Pet*>(unit)->getName().c_str();
487 nameLength = static_cast<uint32_t>(strlen(unitName)) + 1;
488 }
489 else
490 {
491 auto creature = dynamic_cast<Creature*>(unit);
492 unitName = creature->GetCreatureProperties()->Name.c_str();
493 nameLength = static_cast<uint32_t>(strlen(unitName)) + 1;
494 }
495 }
496
497 WDB::Structures::EmotesTextEntry const* emoteTextEntry = sEmotesTextStore.lookupEntry(srlPacket.text_emote);
498 if (emoteTextEntry == nullptr)
499 return;
500
501 sHookInterface.OnEmote(_player, static_cast<EmoteType>(emoteTextEntry->textid), unit);
502 if (unit)
503 {
504 if (unit->IsInWorld() && unit->isCreature() && static_cast<Creature*>(unit)->GetScript())
505 static_cast<Creature*>(unit)->GetScript()->OnEmote(_player, static_cast<EmoteType>(emoteTextEntry->textid));
506 }
507
508 switch (emoteTextEntry->textid)
509 {
510 case EMOTE_STATE_READ:
512 {
513 _player->setEmoteState(emoteTextEntry->textid);
514 } break;
516 case EMOTE_STATE_SIT:
519 break;
520 default:
521 {
522 _player->emote(static_cast<EmoteType>(emoteTextEntry->textid));
523 } break;
524 }
525
526 _player->sendMessageToSet(SmsgTextEmote(nameLength, unitName, srlPacket.text_emote, _player->getGuid(), srlPacket.unk).serialise().get(), true);
527
528 _player->getAchievementMgr()->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE, srlPacket.text_emote, 0, 0);
529
530 sQuestMgr.OnPlayerEmote(_player, srlPacket.text_emote, srlPacket.guid);
531}
@ EMOTE_STATE_SLEEP
@ EMOTE_STATE_SIT
@ EMOTE_STATE_READ
@ EMOTE_STATE_KNEEL
@ EMOTE_STATE_DANCE
SERVER_DECL WDB::WDBContainer< WDB::Structures::EmotesTextEntry > sEmotesTextStore
Definition WDBStores.cpp:77
virtual void OnEmote(Player *, EmoteType)
virtual bool isPet() const
Definition Object.hpp:203
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTimeSyncRespOpcode()

void WorldSession::handleTimeSyncRespOpcode ( WorldPacket recvPacket)
protected

Definition at line 1196 of file MiscHandler.cpp.

1197{
1198#if VERSION_STRING >= Cata
1199 uint32_t counter;
1200 uint32_t clientTicks;
1201 recvPacket >> counter;
1202 recvPacket >> clientTicks;
1203#endif
1204}
Here is the caller graph for this function:

◆ handleToggleCloakOpcode()

void WorldSession::handleToggleCloakOpcode ( WorldPacket )
protected

Definition at line 723 of file MiscHandler.cpp.

724{
727 else
729}
bool hasPlayerFlags(uint32_t flags) const
Definition Player.cpp:786
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleToggleHelmOpcode()

void WorldSession::handleToggleHelmOpcode ( WorldPacket )
protected

Definition at line 715 of file MiscHandler.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTogglePVPOpcode()

void WorldSession::handleTogglePVPOpcode ( WorldPacket )
protected

Definition at line 248 of file MiscHandler.cpp.

249{
251}
void togglePvP()
Definition Player.cpp:8343
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTrainerBuySpellOpcode()

void WorldSession::handleTrainerBuySpellOpcode ( WorldPacket recvPacket)
protected

Definition at line 135 of file NPCHandler.cpp.

136{
137 CmsgTrainerBuySpell srlPacket;
138 if (!srlPacket.deserialise((recvPacket)))
139 return;
140
141 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_TRAINER_BUY_SPELL: {} (guidLowPart)", srlPacket.guid.getGuidLowPart());
142
143 const auto creature = _player->getWorldMapCreature(srlPacket.guid.getGuidLowPart());
144 if (creature == nullptr)
145 return;
146
147 const auto trainer = creature->GetTrainer();
148 if (trainer == nullptr)
149 return;
150
151 TrainerSpell const* trainerSpell = nullptr;
152
153 auto its = sObjectMgr.getTrainerSpellSetById(trainer->spellset_id);
154
155 for (auto& itr : *its)
156 {
157 if ((itr.castSpell && itr.castSpell->getId() == srlPacket.spellId) ||
158 (itr.learnSpell && itr.learnSpell->getId() == srlPacket.spellId))
159 {
160 trainerSpell = &itr;
161 break;
162 }
163 }
164
165 if (trainerSpell == nullptr)
166 {
167 sCheatLog.writefromsession(this, "%s tried to learn none-obtainable spell - Possibly using WPE", _player->getName().c_str());
168 Disconnect();
169 return;
170 }
171
172 const auto spellStatus = trainerGetSpellStatus(trainerSpell);
173 if (spellStatus == TRAINER_SPELL_RED || spellStatus == TRAINER_SPELL_GRAY)
174 return;
175
176 // teach the spell
177 _player->modCoinage(-static_cast<int32_t>(trainerSpell->cost));
178 creature->playSpellVisual(179, 0);
179
180 if (trainerSpell->castSpell != nullptr)
181 {
182 _player->castSpell(_player, trainerSpell->castSpell->getId(), true);
183 }
184 else
185 {
186 _player->playSpellVisual(362, 1);
187
188 if (trainerSpell->learnSpell != nullptr)
189 _player->addSpell(trainerSpell->learnSpell->getId());
190 }
191
192 if (trainerSpell->deleteSpell)
193 {
194 if (trainerSpell->learnSpell)
195 _player->removeSpell(trainerSpell->deleteSpell, true);
196 else if (trainerSpell->castSpell)
197 _player->removeSpell(trainerSpell->deleteSpell, true);
198 else
199 _player->removeSpell(trainerSpell->deleteSpell, true);
200 }
201
202 SendPacket(SmsgTrainerBuySucceeded(srlPacket.guid.getRawGuid(), srlPacket.spellId).serialise().get());
203}
@ TRAINER_SPELL_GRAY
Definition Flags.hpp:17
@ TRAINER_SPELL_RED
Definition Flags.hpp:16
Trainer const * GetTrainer()
void addSpell(uint32_t spellId, uint16_t fromSkill=0)
Definition Player.cpp:3935
bool removeSpell(uint32_t spellId, bool moveToDeleted)
Definition Player.cpp:3945
void playSpellVisual(uint32_t visual_id, uint32_t type)
Definition Unit.cpp:3442
TrainerSpellState trainerGetSpellStatus(TrainerSpell const *trainerSpell) const
SpellInfo const * castSpell
Definition ObjectMgr.hpp:89
SpellInfo const * learnSpell
Definition ObjectMgr.hpp:93
uint32_t deleteSpell
Definition ObjectMgr.hpp:94
uint32_t cost
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTrainerListOpcode()

void WorldSession::handleTrainerListOpcode ( WorldPacket recvPacket)
protected

Definition at line 352 of file NPCHandler.cpp.

353{
354 CmsgTrainerList srlPacket;
355 if (!srlPacket.deserialise(recvPacket))
356 return;
357
358 const auto creature = _player->getWorldMap()->getCreature(srlPacket.guid.getGuidLowPart());
359 if (creature == nullptr)
360 return;
361
362 _player->onTalkReputation(creature->m_factionEntry);
363 sendTrainerList(creature);
364}
void sendTrainerList(Creature *creature)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTransmogrifyItems()

void WorldSession::handleTransmogrifyItems ( WorldPacket recvData)

Definition at line 511 of file ItemHandler.cpp.

512{
513#if VERSION_STRING == Cata
514 sLogger.debug("Received CMSG_TRANSMOGRIFY_ITEMS");
515 Player* player = GetPlayer();
516
517 // Read data
518 uint32_t count = recvData.readBits(22);
519
520 if (count >= EQUIPMENT_SLOT_END)
521 {
522 sLogger.debug("handleTransmogrifyItems - Player (GUID: {}, name: {}) sent a wrong count ({}) when transmogrifying items.", player->getGuidLow(), player->getName(), count);
523 recvData.rfinish();
524 return;
525 }
526
527 std::vector<ObjectGuid> itemGuids(count, ObjectGuid(0));
528 std::vector<uint32_t> newEntries(count, 0);
529 std::vector<uint32_t> slots(count, 0);
530
531 for (uint8_t i = 0; i < count; ++i)
532 {
533 itemGuids[i][0] = recvData.readBit();
534 itemGuids[i][5] = recvData.readBit();
535 itemGuids[i][6] = recvData.readBit();
536 itemGuids[i][2] = recvData.readBit();
537 itemGuids[i][3] = recvData.readBit();
538 itemGuids[i][7] = recvData.readBit();
539 itemGuids[i][4] = recvData.readBit();
540 itemGuids[i][1] = recvData.readBit();
541 }
542
543 ObjectGuid npcGuid;
544 npcGuid[7] = recvData.readBit();
545 npcGuid[3] = recvData.readBit();
546 npcGuid[5] = recvData.readBit();
547 npcGuid[6] = recvData.readBit();
548 npcGuid[1] = recvData.readBit();
549 npcGuid[4] = recvData.readBit();
550 npcGuid[0] = recvData.readBit();
551 npcGuid[2] = recvData.readBit();
552
553 recvData.flushBits();
554
555 for (uint32_t i = 0; i < count; ++i)
556 {
557 recvData >> newEntries[i];
558
559 recvData.ReadByteSeq(itemGuids[i][1]);
560 recvData.ReadByteSeq(itemGuids[i][5]);
561 recvData.ReadByteSeq(itemGuids[i][0]);
562 recvData.ReadByteSeq(itemGuids[i][4]);
563 recvData.ReadByteSeq(itemGuids[i][6]);
564 recvData.ReadByteSeq(itemGuids[i][7]);
565 recvData.ReadByteSeq(itemGuids[i][3]);
566 recvData.ReadByteSeq(itemGuids[i][2]);
567
568 recvData >> slots[i];
569 }
570
571 recvData.ReadByteSeq(npcGuid[7]);
572 recvData.ReadByteSeq(npcGuid[2]);
573 recvData.ReadByteSeq(npcGuid[5]);
574 recvData.ReadByteSeq(npcGuid[4]);
575 recvData.ReadByteSeq(npcGuid[3]);
576 recvData.ReadByteSeq(npcGuid[1]);
577 recvData.ReadByteSeq(npcGuid[6]);
578 recvData.ReadByteSeq(npcGuid[0]);
579
580 Creature* creature = player->getWorldMapCreature(npcGuid);
581 if (!creature)
582 {
583 sLogger.debug("handleTransmogrifyItems - Unit (GUID: {}) not found.", uint64_t(npcGuid));
584 return;
585 }
586
587 // Validate
588 if (!creature->isTransmog() && creature->getDistance(player) > 5.0f)
589 {
590 sLogger.debug("handleTransmogrifyItems - Unit (GUID: {}) can't interact with it or is no Transmogrifier.", uint64_t(npcGuid));
591 return;
592 }
593
594 int32_t cost = 0;
595 for (uint8_t i = 0; i < count; ++i)
596 {
597 // slot of the transmogrified item
598 if (slots[i] >= EQUIPMENT_SLOT_END)
599 {
600 sLogger.debug("handleTransmogrifyItems - Player (GUID: {}, name: {}) tried to transmogrify an item (lowguid: {}) with a wrong slot ({}) when transmogrifying items.", player->getGuidLow(), player->getName(), uint64_t(itemGuids[i]), slots[i]);
601 return;
602 }
603
604 // entry of the transmogrifier item, if it's not 0
605 if (newEntries[i])
606 {
607 ItemProperties const* proto = sMySQLStore.getItemProperties(newEntries[i]);
608 if (!proto)
609 {
610 sLogger.debug("handleTransmogrifyItems - Player (GUID: {}, name: {}) tried to transmogrify to an invalid item (entry: {}).", player->getGuidLow(), player->getName(), newEntries[i]);
611 return;
612 }
613 }
614
615 Item* itemTransmogrifier = nullptr;
616 // guid of the transmogrifier item, if it's not 0
617 if (itemGuids[i])
618 {
619 itemTransmogrifier = player->getItemInterface()->GetItemByGUID(itemGuids[i]);
620 if (!itemTransmogrifier)
621 {
622 sLogger.debug("handleTransmogrifyItems - Player (GUID: {}, name: {}) tried to transmogrify with an invalid item (lowguid: {}).", player->getGuidLow(), player->getName(), uint64_t(itemGuids[i]));
623 return;
624 }
625 }
626
627 // transmogrified item
628 Item* itemTransmogrified = player->getItemInterface()->GetInventoryItem(slots[i]);
629 if (!itemTransmogrified)
630 {
631 sLogger.debug("handleTransmogrifyItems - Player (GUID: {}, name: {}) tried to transmogrify an invalid item in a valid slot (slot: {}).", player->getGuidLow(), player->getName(), slots[i]);
632 return;
633 }
634
635 if (!newEntries[i]) // reset look
636 {
638 player->setVisibleItemFields(slots[i], itemTransmogrified);
639 }
640 else
641 {
642 if (!Item::canTransmogrifyItemWithItem(itemTransmogrified, itemTransmogrifier))
643 {
644 sLogger.debug("handleTransmogrifyItems - Player (GUID: {}, name: {}) failed CanTransmogrifyItemWithItem ({} with {}).", player->getGuidLow(), player->getName(), itemTransmogrified->getEntry(), itemTransmogrifier->getEntry());
645 return;
646 }
647
648 // All okay, proceed
649 itemTransmogrified->addEnchantment(newEntries[i], TRANSMOGRIFY_ENCHANTMENT_SLOT, 0);
650 player->setVisibleItemFields(slots[i], itemTransmogrified);
651
652 itemTransmogrified->setOwnerGuid(player->getGuid());
653 itemTransmogrified->removeFromRefundableMap();
654 itemTransmogrified->removeFlags(ITEM_FLAG_BOP_TRADEABLE); // todo implement this properly
655
656 if (itemTransmogrifier->getItemProperties()->Bonding == ITEM_BIND_ON_EQUIP || itemTransmogrifier->getItemProperties()->Bonding == ITEM_BIND_ON_USE)
657 itemTransmogrifier->addFlags(ITEM_FLAG_SOULBOUND);
658
659 cost += 10000; // todo implement this properly
660 }
661 }
662
663 // trusting the client, if it got here it has to have enough money
664 // ... unless client was modified
665 if (cost) // 0 cost if reverting look
666 player->modCoinage(-cost);
667#endif
668}
void flushBits()
Definition ByteBuffer.h:93
bool isTransmog() const
Definition Creature.cpp:271
static bool canTransmogrifyItemWithItem(Item const *transmogrified, Item const *transmogrifier)
Definition Item.cpp:1073
void setOwnerGuid(uint64_t guid)
Definition Item.cpp:132
void removeFlags(uint32_t flags)
Definition Item.cpp:190
void removeFromRefundableMap()
Definition Item.cpp:641
void setVisibleItemFields(uint32_t slot, Item *item)
Definition Player.cpp:9895
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTutorialClear()

void WorldSession::handleTutorialClear ( WorldPacket )
protected

Definition at line 277 of file MiscHandler.cpp.

278{
279 for (uint8_t id = 0; id < 8; ++id)
280 _player->setTutorialValueForId(id, 0xFFFFFFFF);
281}
void setTutorialValueForId(uint8_t id, uint32_t value)
Definition Player.cpp:6341
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTutorialFlag()

void WorldSession::handleTutorialFlag ( WorldPacket recvPacket)
protected

Definition at line 253 of file MiscHandler.cpp.

254{
255 CmsgTutorialFlag srlPacket;
256 if (!srlPacket.deserialise(recvPacket))
257 return;
258
259 const uint32_t packet_index = (srlPacket.flag / 32);
260 const uint32_t tutorial_status = (srlPacket.flag % 32);
261
262 if (packet_index >= 7)
263 {
264 Disconnect();
265 return;
266 }
267
268 const auto tutorial_index = static_cast<uint8_t>(packet_index);
269
270 uint32_t tutorial_flag = _player->getTutorialValueById(tutorial_index);
271 tutorial_flag |= (1 << tutorial_status);
272 _player->setTutorialValueForId(tutorial_index, tutorial_flag);
273
274 sLogger.debug("Received Tutorial flag: ({}).", srlPacket.flag);
275}
uint32_t getTutorialValueById(uint8_t id)
Definition Player.cpp:6334
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleTutorialReset()

void WorldSession::handleTutorialReset ( WorldPacket )
protected

Definition at line 283 of file MiscHandler.cpp.

284{
285 for (uint8_t id = 0; id < 8; ++id)
286 _player->setTutorialValueForId(id, 0x00000000);
287}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleUITimeRequestOpcode()

void WorldSession::handleUITimeRequestOpcode ( WorldPacket )
protected

Definition at line 1187 of file MiscHandler.cpp.

1188{
1189#if VERSION_STRING >= Cata
1190 WorldPacket data(SMSG_UI_TIME, 4);
1191 data << uint32_t(time(nullptr));
1192 SendPacket(&data);
1193#endif
1194}
@ SMSG_UI_TIME
Definition Opcodes.hpp:1747
Here is the call graph for this function:

◆ handleUnacceptTrade()

void WorldSession::handleUnacceptTrade ( WorldPacket )
protected

Definition at line 601 of file TradeHandler.cpp.

602{
603#if VERSION_STRING < Cata
604 const auto tradeData = _player->getTradeData();
605 if (tradeData == nullptr)
606 return;
607
609 tradeData->getTradeTarget()->getSession()->sendTradeResult(TRADE_STATUS_UNACCEPTED);
610
611 _player->getTradeData()->setTradeAccepted(false, true);
612#endif
613}
@ TRADE_STATUS_UNACCEPTED
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleUnlearnSkillOpcode()

void WorldSession::handleUnlearnSkillOpcode ( WorldPacket recvPacket)
protected

Definition at line 17 of file SkillHandler.cpp.

18{
19 CmsgUnlearnSkill srlPacket;
20 if (!srlPacket.deserialise(recvPacket))
21 return;
22
23 _player->removeSkillLine(static_cast<uint16_t>(srlPacket.skillLineId));
24}
void removeSkillLine(uint16_t skillLine)
Definition Player.cpp:5068
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleUnlearnTalents()

void WorldSession::handleUnlearnTalents ( WorldPacket recvPacket)
protected

Definition at line 36 of file SkillHandler.cpp.

37{
38 const uint32_t resetPrice = _player->calcTalentResetCost(_player->getTalentResetsCount());
39 if (!_player->hasEnoughCoinage(resetPrice))
40 return;
41
43 _player->modCoinage(-static_cast<int32_t>(resetPrice));
45}
uint32_t calcTalentResetCost(uint32_t resetnum) const
Definition Player.cpp:6321
void resetTalents()
Definition Player.cpp:5966
uint32_t getTalentResetsCount() const
Definition Player.cpp:6318
void setTalentResetsCount(uint32_t value)
Definition Player.cpp:6319
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleUnregisterAddonPrefixesOpcode()

void WorldSession::handleUnregisterAddonPrefixesOpcode ( WorldPacket )
protected

Definition at line 2263 of file MiscHandler.cpp.

2264{
2265#if VERSION_STRING >= Cata
2266 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_UNREGISTER_ALL_ADDON_PREFIXES");
2267
2269#endif
2270}
Here is the caller graph for this function:

◆ handleUnstablePet()

void WorldSession::handleUnstablePet ( WorldPacket recvPacket)
protected

Definition at line 328 of file PetHandler.cpp.

329{
330 CmsgUnstablePet srlPacket;
331 if (!srlPacket.deserialise(recvPacket))
332 return;
333
334 // Check if player is actually performing a swap
335 const auto foundSlot = _player->findFreeActivePetSlot();
336 if (!foundSlot.has_value())
337 {
338 // Client sends unstable packet instead of swap packet if current pet is dismissed and player starts from stable slot
340 return;
341 }
342 else
343 {
344 if (!_player->tryPutPetToSlot(srlPacket.petNumber, foundSlot.value()))
345 return;
346
347 // If pet is taken from first stable slot, client automatically shifts next pet in stables to this first slot
348 // Pre-cata pet slots do not actually exist but we must update our serverside pet slots
349 for (uint8_t i = PET_SLOT_FIRST_STABLE_SLOT; i < PET_SLOT_LAST_STABLE_SLOT; ++i)
350 {
352 break;
353
354 if (!_player->hasPetInSlot(i))
355 {
356 // Found empty slot, check if there is pet in next slot and move it to this slot
357 const auto nextPetId = _player->getPetIdFromSlot(i + 1);
358 if (nextPetId.has_value())
359 _player->tryPutPetToSlot(nextPetId.value(), i);
360 }
361 }
362 }
363
364 // Summon unstabled pet if pet is alive and player is able to summon it
366 {
367 if (const auto petCache = _player->getPetCache(srlPacket.petNumber))
368 {
369 if (petCache->alive)
370 _player->_spawnPet(petCache);
371 }
372 }
373
375}
@ PET_SLOT_LAST_STABLE_SLOT
@ PET_SLOT_FIRST_STABLE_SLOT
std::optional< uint8_t > findFreeActivePetSlot() const
Definition Player.cpp:12349
std::optional< uint8_t > getPetIdFromSlot(uint8_t slot) const
Definition Player.cpp:12335
bool hasPetInSlot(uint8_t slot) const
Definition Player.cpp:12344
bool isPetRequiringTemporaryUnsummon() const
Definition Player.cpp:12593
void _spawnPet(PetCache const *petCache)
Definition Player.cpp:12707
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleUpdateAccountData()

void WorldSession::handleUpdateAccountData ( WorldPacket recvPacket)
protected

Definition at line 817 of file MiscHandler.cpp.

818{
819 if (!worldConfig.server.useAccountData)
820 return;
821
822 CmsgUpdateAccountData srlPacket;
823 if (!srlPacket.deserialise(recvPacket))
824 return;
825
826 if (srlPacket.uiId > 8)
827 {
828 sLogger.failure("WARNING: Accountdata > 8 ({}) was requested to be updated by {} of account {}!",
829 srlPacket.uiId, _player->getName(), this->GetAccountId());
830 return;
831 }
832
833 uLongf uid = srlPacket.uiDecompressedSize;
834
835 if (srlPacket.uiDecompressedSize == 0)
836 {
837 SetAccountData(srlPacket.uiId, NULL, false, 0);
838#if VERSION_STRING > TBC
840#endif
841 return;
842 }
843
844 size_t receivedPackedSize = recvPacket.size() - 8;
845 auto data = std::make_unique<char[]>(srlPacket.uiDecompressedSize + 1);
846 memset(data.get(), 0, srlPacket.uiDecompressedSize + 1);
847
848 if (srlPacket.uiDecompressedSize > receivedPackedSize)
849 {
850 const int32_t ZlibResult = uncompress(reinterpret_cast<uint8_t*>(data.get()), &uid, recvPacket.contents() + 8,
851 static_cast<uLong>(receivedPackedSize));
852
853 switch (ZlibResult)
854 {
855 case Z_OK: //0 no error decompression is OK
856 {
857 SetAccountData(srlPacket.uiId, std::move(data), false, srlPacket.uiDecompressedSize);
858 sLogger.debug("Successfully decompressed account data {} for {}, and updated storage array.",
859 srlPacket.uiId, _player->getName());
860 } break;
861 case Z_ERRNO: //-1
862 case Z_STREAM_ERROR: //-2
863 case Z_DATA_ERROR: //-3
864 case Z_MEM_ERROR: //-4
865 case Z_BUF_ERROR: //-5
866 case Z_VERSION_ERROR: //-6
867 {
868 sLogger.failure("Decompression of account data {} for {} FAILED.", srlPacket.uiId, _player->getName());
869 } break;
870
871 default:
872 {
873 sLogger.failure("Decompression gave a unknown error: {:x}, of account data {} for {} FAILED.",
874 ZlibResult, srlPacket.uiId, _player->getName());
875 } break;
876 }
877 }
878 else
879 {
880 memcpy(data.get(), recvPacket.contents() + 8, srlPacket.uiDecompressedSize);
881 SetAccountData(srlPacket.uiId, std::move(data), false, srlPacket.uiDecompressedSize);
882 }
883
884#if VERSION_STRING > TBC
886#endif
887}
void SetAccountData(uint32_t index, std::unique_ptr< char[]> data, bool initial, uint32_t sz)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleUpdateProjectilePosition()

void WorldSession::handleUpdateProjectilePosition ( WorldPacket recvPacket)
protected

Definition at line 380 of file SpellHandler.cpp.

381{
382 uint64_t casterGuid;
383 uint32_t spellId;
384 uint8_t castCount;
385 float x, y, z; // Projectile hit location
386
387 recvPacket >> casterGuid >> spellId >> castCount >> x >> y >> z;
388
389 Unit* caster = _player->getWorldMap()->getUnit(casterGuid);
390 if (caster == nullptr)
391 return;
392
393 Spell* curSpell = _player->findCurrentCastedSpellBySpellId(spellId);
394 if (curSpell == nullptr || !curSpell->m_targets.hasDestination())
395 return;
396
397 // Relocate spell
398 curSpell->m_targets.setDestination(LocationVector(x, y, z));
399
400#if VERSION_STRING > TBC
402 data << uint64_t(casterGuid);
403 data << uint8_t(castCount);
404 data << float(x);
405 data << float(y);
406 data << float(z);
407 caster->sendMessageToSet(&data, true);
408#endif
409}
@ SMSG_SET_PROJECTILE_POSITION
Definition Opcodes.hpp:1347
Spell * findCurrentCastedSpellBySpellId(uint32_t spellId)
Definition Object.cpp:759
void setDestination(LocationVector destination)
bool hasDestination() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleUseItemOpcode()

void WorldSession::handleUseItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 62 of file ItemHandler.cpp.

63{
64 CmsgUseItem srlPacket;
65 if (!srlPacket.deserialise(recvPacket))
66 return;
67
68 Item* tmpItem = _player->getItemInterface()->GetInventoryItem(srlPacket.containerIndex, srlPacket.inventorySlot);
69 if (tmpItem == nullptr)
70 {
72 }
73
74 if (tmpItem == nullptr)
75 {
77 return;
78 }
79
80 if (tmpItem->getGuid() != srlPacket.itemGuid)
81 {
83 return;
84 }
85
86 ItemProperties const* itemProto = tmpItem->getItemProperties();
87 if (!itemProto)
88 {
90 return;
91 }
92
93 // Equipable items needs to be equipped before use
94 if (itemProto->InventoryType != INVTYPE_NON_EQUIP && !_player->getItemInterface()->IsEquipped(itemProto->ItemId))
95 {
96 // todo: is this correct error msg?
98 return;
99 }
100
101 if (!_player->isAlive())
102 {
104 return;
105 }
106
107 if (tmpItem->isSoulbound() && tmpItem->getOwnerGuid() != _player->getGuid() && !tmpItem->isAccountbound())
108 {
110 return;
111 }
112
113 if ((itemProto->Flags2 & ITEM_FLAG2_HORDE_ONLY) && _player->getTeam() != TEAM_HORDE ||
115 {
117 return;
118 }
119
120 if ((itemProto->AllowableClass != 0 && !(itemProto->AllowableClass & _player->getClassMask())) || (itemProto->AllowableRace != 0 && !(itemProto->AllowableRace & _player->getRaceMask())))
121 {
123 return;
124 }
125
126 if (itemProto->RequiredSkill)
127 {
128 if (!_player->hasSkillLine(itemProto->RequiredSkill))
129 {
131 return;
132 }
133 else if (_player->getSkillLineCurrent(itemProto->RequiredSkill) < itemProto->RequiredSkillRank)
134 {
136 return;
137 }
138 }
139
140 if (itemProto->RequiredSpell != 0 && !_player->hasSpell(itemProto->RequiredSpell))
141 {
143 return;
144 }
145
146 if (_player->getLevel() < itemProto->RequiredLevel)
147 {
149 return;
150 }
151
152 // Learning spells (mounts, companion pets etc)
153 if (itemProto->Spells[0].Id == 483 || itemProto->Spells[0].Id == 55884)
154 {
155 if (_player->hasSpell(itemProto->Spells[1].Id))
156 // No error message, handled elsewhere
157 return;
158 }
159
160 if (itemProto->RequiredFaction && uint32_t(_player->getFactionStanding(itemProto->RequiredFaction)) < itemProto->RequiredFactionStanding)
161 {
163 return;
164 }
165
166 // Arena cases
167 if (_player->m_bg != nullptr && _player->m_bg->isArena())
168 {
169 // Not all consumables are usable in arena
170 if (itemProto->Class == ITEM_CLASS_CONSUMABLE && !itemProto->HasFlag(ITEM_FLAG_USEABLE_IN_ARENA))
171 {
173 return;
174 }
175
176 // Not all items are usable in arena
178 {
180 return;
181 }
182 }
183
184 if (itemProto->Bonding == ITEM_BIND_ON_USE || itemProto->Bonding == ITEM_BIND_ON_PICKUP || itemProto->Bonding == ITEM_BIND_QUEST)
185 {
186 if (!tmpItem->isSoulbound())
188 }
189
190 // Combat check
192 {
193 for (uint8_t i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
194 {
195 if (SpellInfo const* spellInfo = sSpellMgr.getSpellInfo(itemProto->Spells[i].Id))
196 {
197 if (spellInfo->getAttributes() & ATTRIBUTES_REQ_OOC)
198 {
200 return;
201 }
202 }
203 }
204 }
205
206 // Trade check
208 {
210 return;
211 }
212
213 // Start quest
214 if (itemProto->QuestId)
215 {
216 QuestProperties const* quest = sMySQLStore.getQuestProperties(itemProto->QuestId);
217 if (!quest)
218 return;
219
220 // Create packet
221 WorldPacket data;
222 sQuestMgr.BuildQuestDetails(&data, quest, tmpItem, 0, language, _player);
223 SendPacket(&data);
224 }
225
226 // Anticheat to prevent WDB editing
227 bool found = false;
228 uint32_t spellId = 0;
229 uint8_t spellIndex = 0;
230
231#if VERSION_STRING == TBC
232 spellIndex = srlPacket.spellIndex;
233 if (spellIndex < MAX_ITEM_PROTO_SPELLS)
234 {
235 if (itemProto->Spells[spellIndex].Trigger == USE && itemProto->Spells[spellIndex].Id != 0)
236 {
237 found = true;
238 spellId = itemProto->Spells[spellIndex].Id;
239 }
240 }
241#else
242 for (uint8_t i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
243 {
244 if (itemProto->Spells[i].Trigger == USE && itemProto->Spells[i].Id == srlPacket.spellId)
245 {
246 found = true;
247 spellId = srlPacket.spellId;
248 spellIndex = i;
249 break;
250 }
251 }
252#endif
253
254 if (tmpItem->hasOnUseSpellIid(spellId))
255 found = true;
256
257 // Item doesn't have this spell, either player is cheating or player's itemcache.wdb doesn't match with database
258 if (!found)
259 {
260 Disconnect();
261 Anticheat_Log->writefromsession(this, "Player tried to use an item with a spell that didn't match the spell in the database.");
262 Anticheat_Log->writefromsession(this, "Possibly corrupted or intentionally altered itemcache.wdb");
263 Anticheat_Log->writefromsession(this, "Itemid: %u", itemProto->ItemId);
264 Anticheat_Log->writefromsession(this, "Spellid: %u", spellId);
265 Anticheat_Log->writefromsession(this, "Player was disconnected.");
266 return;
267 }
268
269 // Cooldown check
270 if (!_player->cooldownCanCast(itemProto, spellIndex))
271 {
273 return;
274 }
275
276 // Cast check
277 if (_player->isCastingSpell(false, true))
278 {
280 return;
281 }
282
283 // Call item scripts
284 if (sScriptMgr.CallScriptedItem(tmpItem, _player))
285 return;
286
287 // In "learning" spells, set the spell id to be taught as spell's forced basepoints
288 uint32_t spellToLearn = 0;
289 if (itemProto->Spells[0].Id == 483 || itemProto->Spells[0].Id == 55884)
290 {
291 spellId = itemProto->Spells[0].Id;
292 spellToLearn = itemProto->Spells[1].Id;
293 }
294
295 SpellCastTargets targets(recvPacket, _player->getGuid());
296 const auto spellInfo = sSpellMgr.getSpellInfo(spellId);
297 if (spellInfo == nullptr)
298 {
299 sLogger.failure("WORLD: Unknown spell id {} in ::handleUseItemOpcode() from item id {}", spellId, itemProto->ItemId);
300 return;
301 }
302
303 // Stand up if player is sitting
304 if (!(spellInfo->getAuraInterruptFlags() & AURA_INTERRUPT_ON_STAND_UP) && !_player->isMounted())
305 {
308 }
309
310 // TODO: remove this and get rid of 'ForcedPetId' hackfix
311 // move the spells from MySQLDataStore.cpp to SpellScript
312 if (itemProto->ForcedPetId >= 0)
313 {
314 if (itemProto->ForcedPetId == 0)
315 {
316 if (targets.getUnitTargetGuid() != _player->getGuid())
317 {
318 _player->sendCastFailedPacket(spellInfo->getId(), SPELL_FAILED_BAD_TARGETS, srlPacket.castCount, 0);
319 return;
320 }
321 }
322 else
323 {
324 if (!_player->getPet() || _player->getPet()->getEntry() != static_cast<uint32_t>(itemProto->ForcedPetId))
325 {
326 _player->sendCastFailedPacket(spellInfo->getId(), SPELL_FAILED_BAD_TARGETS, srlPacket.castCount, 0);
327 return;
328 }
329 }
330 }
331
332 Spell* spell = sSpellMgr.newSpell(_player, spellInfo, false, nullptr);
333 spell->extra_cast_number = srlPacket.castCount;
334 spell->setItemCaster(tmpItem);
335
336 if (spellToLearn != 0)
337 spell->forced_basepoints->set(0, spellToLearn);
338
339#if VERSION_STRING >= WotLK
340 spell->m_glyphslot = srlPacket.glyphIndex;
341
342 // Some spell cast packets include more data
343 if (srlPacket.castFlags & 0x02)
344 {
345 float projectilePitch, projectileSpeed;
346 uint8_t hasMovementData; // 1 or 0
347 recvPacket >> projectilePitch >> projectileSpeed >> hasMovementData;
348
349 LocationVector const spellDestination = targets.getDestination();
350 LocationVector const spellSource = targets.getSource();
351 float const deltaX = spellDestination.x - spellSource.x; // Calculate change of x position
352 float const deltaY = spellDestination.y - spellSource.y; // Calculate change of y position
353
354 uint32_t travelTime = 0;
355 if ((projectilePitch != M_PI / 4) && (projectilePitch != -M_PI / 4)) // No division by zero
356 {
357 // Calculate projectile's travel time by using Pythagorean theorem to get distance from delta X and delta Y, and divide that with the projectile's velocity
358 travelTime = static_cast<uint32_t>((sqrtf(deltaX * deltaX + deltaY * deltaY) / (cosf(projectilePitch) * projectileSpeed)) * 1000);
359 }
360
361 if (hasMovementData)
362 {
363 recvPacket.SetOpcode(recvPacket.read<uint16_t>()); // MSG_MOVE_STOP
364 handleMovementOpcodes(recvPacket);
365 }
366
367 spell->m_missilePitch = projectilePitch;
368 spell->m_missileTravelTime = travelTime;
369 }
370#endif
371
372 spell->prepare(&targets);
373
374#ifdef FT_ACHIEVEMENTS
375 _player->updateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, itemProto->ItemId, 0, 0);
376#endif
377}
@ AURA_INTERRUPT_ON_STAND_UP
@ USE
@ ITEM_FLAG_USEABLE_IN_ARENA
@ ITEM_FLAG_NOT_USEABLE_IN_ARENA
@ ITEM_CLASS_CONSUMABLE
@ ITEM_BIND_QUEST
@ INV_ERR_NO_REQUIRED_PROFICIENCY
@ INV_ERR_ITEM_REPUTATION_NOT_ENOUGH
@ INV_ERR_NOT_DURING_ARENA_MATCH
@ INV_ERR_YOU_MUST_REACH_LEVEL_N
@ INVTYPE_NON_EQUIP
@ ITEM_FLAG2_HORDE_ONLY
@ ITEM_FLAG2_ALLIANCE_ONLY
#define MAX_ITEM_PROTO_SPELLS
@ ATTRIBUTES_REQ_OOC
@ SPELL_FAILED_BAD_TARGETS
bool isItemInTradeWindow(Item const *item) const
bool hasOnUseSpellIid(uint32_t id) const
Definition Item.cpp:652
uint64_t getOwnerGuid() const
Definition Item.cpp:129
bool cooldownCanCast(ItemProperties const *itemProp, uint32_t spellIndex)
Definition Player.cpp:4502
int32_t getFactionStanding(uint32_t faction)
Definition Player.cpp:11432
std::shared_ptr< SpellForcedBasePoints > forced_basepoints
Definition Spell.hpp:245
bool isMounted() const
Definition Unit.cpp:8541
uint32_t getClassMask() const
Definition Unit.hpp:221
uint32_t getRaceMask() const
Definition Unit.hpp:217
bool HasFlag(uint32_t flag) const
SERVER_DECL std::unique_ptr< SessionLog > Anticheat_Log
Definition Master.cpp:83
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleViolenceLevel()

void WorldSession::handleViolenceLevel ( WorldPacket recvPacket)
protected

Definition at line 2557 of file MiscHandler.cpp.

2558{
2559 uint8_t violenceLevel;
2560 recvPacket >> violenceLevel;
2561}
Here is the caller graph for this function:

◆ handleVoidStorageQuery()

void WorldSession::handleVoidStorageQuery ( WorldPacket recvData)

Definition at line 77 of file VoidStorageHandler.cpp.

78{
79#if VERSION_STRING >= Cata
80 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_VOID_STORAGE_QUERY");
81 Player* player = GetPlayer();
82
83 ObjectGuid npcGuid;
84 npcGuid[4] = recvData.readBit();
85 npcGuid[0] = recvData.readBit();
86 npcGuid[5] = recvData.readBit();
87 npcGuid[7] = recvData.readBit();
88 npcGuid[6] = recvData.readBit();
89 npcGuid[3] = recvData.readBit();
90 npcGuid[1] = recvData.readBit();
91 npcGuid[2] = recvData.readBit();
92
93 recvData.ReadByteSeq(npcGuid[5]);
94 recvData.ReadByteSeq(npcGuid[6]);
95 recvData.ReadByteSeq(npcGuid[3]);
96 recvData.ReadByteSeq(npcGuid[7]);
97 recvData.ReadByteSeq(npcGuid[1]);
98 recvData.ReadByteSeq(npcGuid[0]);
99 recvData.ReadByteSeq(npcGuid[4]);
100 recvData.ReadByteSeq(npcGuid[2]);
101
102 Creature* creature = player->getWorldMapCreature(npcGuid);
103 if (!creature)
104 {
105 sLogger.debug("handleVoidStorageQuery - Unit (GUID: {}) not found.", uint64_t(npcGuid));
106 return;
107 }
108
109 // Validate
110 if (!creature->isVoidStorage() && creature->getDistance(player) > 5.0f)
111 {
112 sLogger.debug("handleVoidStorageQuery - Unit (GUID: {}) can't interact with it or is no Void Storage.", uint64_t(npcGuid));
113 return;
114 }
115
116 if (!player->isVoidStorageUnlocked())
117 {
118 sLogger.debug("handleVoidStorageQuery - Player (GUID: {}, name: {}) queried void storage without unlocking it.", player->getGuidLow(), player->getName());
119 return;
120 }
121
122 uint8_t count = 0;
123 for (uint8_t i = 0; i < VOID_STORAGE_MAX_SLOT; ++i)
124 if (player->getVoidStorageItem(i))
125 ++count;
126
127 WorldPacket data(SMSG_VOID_STORAGE_CONTENTS, 2 * count + (14 + 4 + 4 + 4 + 4) * count);
128
129 data.writeBits(count, 8);
130
131 ByteBuffer itemData((14 + 4 + 4 + 4 + 4) * count);
132
133 for (uint8_t i = 0; i < VOID_STORAGE_MAX_SLOT; ++i)
134 {
135 VoidStorageItem* item = player->getVoidStorageItem(i);
136 if (!item)
137 continue;
138
139 ObjectGuid itemId = item->itemId;
140 ObjectGuid creatorGuid = item->creatorGuid;
141
142 data.writeBit(creatorGuid[3]);
143 data.writeBit(itemId[5]);
144 data.writeBit(creatorGuid[6]);
145 data.writeBit(creatorGuid[1]);
146 data.writeBit(itemId[1]);
147 data.writeBit(itemId[3]);
148 data.writeBit(itemId[6]);
149 data.writeBit(creatorGuid[5]);
150 data.writeBit(creatorGuid[2]);
151 data.writeBit(itemId[2]);
152 data.writeBit(creatorGuid[4]);
153 data.writeBit(itemId[0]);
154 data.writeBit(itemId[4]);
155 data.writeBit(itemId[7]);
156 data.writeBit(creatorGuid[0]);
157 data.writeBit(creatorGuid[7]);
158
159 itemData.WriteByteSeq(creatorGuid[3]);
160
161 itemData << uint32_t(item->itemSuffixFactor);
162
163 itemData.WriteByteSeq(creatorGuid[4]);
164
165 itemData << uint32_t(i);
166
167 itemData.WriteByteSeq(itemId[0]);
168 itemData.WriteByteSeq(itemId[6]);
169 itemData.WriteByteSeq(creatorGuid[0]);
170
171 itemData << uint32_t(item->itemRandomPropertyId);
172
173 itemData.WriteByteSeq(itemId[4]);
174 itemData.WriteByteSeq(itemId[5]);
175 itemData.WriteByteSeq(itemId[2]);
176 itemData.WriteByteSeq(creatorGuid[2]);
177 itemData.WriteByteSeq(creatorGuid[6]);
178 itemData.WriteByteSeq(itemId[1]);
179 itemData.WriteByteSeq(itemId[3]);
180 itemData.WriteByteSeq(creatorGuid[5]);
181 itemData.WriteByteSeq(creatorGuid[7]);
182
183 itemData << uint32_t(item->itemEntry);
184
185 itemData.WriteByteSeq(itemId[7]);
186 }
187
188 data.flushBits();
189 data.append(itemData);
190
191 SendPacket(&data);
192#endif
193}
#define VOID_STORAGE_MAX_SLOT
@ SMSG_VOID_STORAGE_CONTENTS
Definition Opcodes.hpp:1755
bool isVoidStorage() const
Definition Creature.cpp:273
uint32_t itemSuffixFactor
uint32_t itemRandomPropertyId
uint32_t creatorGuid
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleVoidStorageTransfer()

void WorldSession::handleVoidStorageTransfer ( WorldPacket recvData)

Definition at line 195 of file VoidStorageHandler.cpp.

196{
197#if VERSION_STRING >= Cata
198 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_VOID_STORAGE_TRANSFER");
199 Player* player = GetPlayer();
200
201 // Read everything
202
203 ObjectGuid npcGuid;
204 npcGuid[1] = recvData.readBit();
205
206 uint32_t countDeposit = recvData.readBits(26);
207
208 if (countDeposit > 9)
209 {
210 sLogger.debug("handleVoidStorageTransfer - Player (GUID: {}, name: {}) wants to deposit more than 9 items ({}).", player->getGuidLow(), player->getName(), countDeposit);
211 return;
212 }
213
214 std::vector<ObjectGuid> itemGuids(countDeposit);
215 for (uint32_t i = 0; i < countDeposit; ++i)
216 {
217 itemGuids[i][4] = recvData.readBit();
218 itemGuids[i][6] = recvData.readBit();
219 itemGuids[i][7] = recvData.readBit();
220 itemGuids[i][0] = recvData.readBit();
221 itemGuids[i][1] = recvData.readBit();
222 itemGuids[i][5] = recvData.readBit();
223 itemGuids[i][3] = recvData.readBit();
224 itemGuids[i][2] = recvData.readBit();
225 }
226
227 npcGuid[2] = recvData.readBit();
228 npcGuid[0] = recvData.readBit();
229 npcGuid[3] = recvData.readBit();
230 npcGuid[5] = recvData.readBit();
231 npcGuid[6] = recvData.readBit();
232 npcGuid[4] = recvData.readBit();
233
234 uint32_t countWithdraw = recvData.readBits(26);
235
236 if (countWithdraw > 9)
237 {
238 sLogger.debug("handleVoidStorageTransfer - Player (GUID: {}, name: {}) wants to withdraw more than 9 items ({}).", player->getGuidLow(), player->getName(), countWithdraw);
239 return;
240 }
241
242 std::vector<ObjectGuid> itemIds(countWithdraw);
243 for (uint32_t i = 0; i < countWithdraw; ++i)
244 {
245 itemIds[i][4] = recvData.readBit();
246 itemIds[i][7] = recvData.readBit();
247 itemIds[i][1] = recvData.readBit();
248 itemIds[i][0] = recvData.readBit();
249 itemIds[i][2] = recvData.readBit();
250 itemIds[i][3] = recvData.readBit();
251 itemIds[i][5] = recvData.readBit();
252 itemIds[i][6] = recvData.readBit();
253 }
254
255 npcGuid[7] = recvData.readBit();
256
257 recvData.flushBits();
258
259 for (uint32_t i = 0; i < countDeposit; ++i)
260 {
261 recvData.ReadByteSeq(itemGuids[i][6]);
262 recvData.ReadByteSeq(itemGuids[i][1]);
263 recvData.ReadByteSeq(itemGuids[i][0]);
264 recvData.ReadByteSeq(itemGuids[i][2]);
265 recvData.ReadByteSeq(itemGuids[i][4]);
266 recvData.ReadByteSeq(itemGuids[i][5]);
267 recvData.ReadByteSeq(itemGuids[i][3]);
268 recvData.ReadByteSeq(itemGuids[i][7]);
269 }
270
271 recvData.ReadByteSeq(npcGuid[5]);
272 recvData.ReadByteSeq(npcGuid[6]);
273
274 for (uint32_t i = 0; i < countWithdraw; ++i)
275 {
276 recvData.ReadByteSeq(itemIds[i][3]);
277 recvData.ReadByteSeq(itemIds[i][1]);
278 recvData.ReadByteSeq(itemIds[i][0]);
279 recvData.ReadByteSeq(itemIds[i][6]);
280 recvData.ReadByteSeq(itemIds[i][2]);
281 recvData.ReadByteSeq(itemIds[i][7]);
282 recvData.ReadByteSeq(itemIds[i][5]);
283 recvData.ReadByteSeq(itemIds[i][4]);
284 }
285
286 recvData.ReadByteSeq(npcGuid[1]);
287 recvData.ReadByteSeq(npcGuid[4]);
288 recvData.ReadByteSeq(npcGuid[7]);
289 recvData.ReadByteSeq(npcGuid[3]);
290 recvData.ReadByteSeq(npcGuid[2]);
291 recvData.ReadByteSeq(npcGuid[0]);
292
293 Creature* creature = player->getWorldMapCreature(npcGuid);
294 if (!creature)
295 {
296 sLogger.debug("handleVoidStorageTransfer - Unit (GUID: {}) not found.", uint64_t(npcGuid));
297 return;
298 }
299
300 // Validate
301 if (!creature->isVoidStorage() && creature->getDistance(player) > 5.0f)
302 {
303 sLogger.debug("handleVoidStorageTransfer - Unit (GUID: {}) can't interact with it or is no Void Storage.", uint64_t(npcGuid));
304 return;
305 }
306
307 if (!player->isVoidStorageUnlocked())
308 {
309 sLogger.debug("handleVoidStorageTransfer - Player (GUID: {}, name: {}) queried void storage without unlocking it.", player->getGuidLow(), player->getName());
310 return;
311 }
312
313 if (itemGuids.size() > player->getNumOfVoidStorageFreeSlots())
314 {
316 return;
317 }
318
319 uint32_t freeBagSlots = 0;
320 if (itemIds.size() != 0)
321 {
322 freeBagSlots = player->getItemInterface()->CalculateFreeSlots(nullptr);
323 }
324
325 if (itemIds.size() > freeBagSlots)
326 {
328 return;
329 }
330
331 if (player->getCoinage() < uint64_t(itemGuids.size() * VOID_STORAGE_STORE_ITEM))
332 {
334 return;
335 }
336
337 std::pair<VoidStorageItem, uint8_t> depositItems[VOID_STORAGE_MAX_DEPOSIT];
338 uint8_t depositCount = 0;
339 for (std::vector<ObjectGuid>::iterator itr = itemGuids.begin(); itr != itemGuids.end(); ++itr)
340 {
341 Item* item = player->getItemInterface()->GetItemByGUID(*itr);
342 if (!item)
343 {
344 sLogger.debug("handleVoidStorageTransfer - Player (GUID: {}, name: {}) wants to deposit an invalid item (item guid: %I64u).", player->getGuidLow(), player->getName(), uint64_t(*itr));
345 continue;
346 }
347
348 VoidStorageItem itemVS(sObjectMgr.generateVoidStorageItemId(), item->getEntry(), static_cast<uint32_t>(item->getCreatorGuid()), item->getRandomPropertiesId(), item->getPropertySeed());
349
350 uint8_t slot = player->addVoidStorageItem(itemVS);
351
352 depositItems[depositCount++] = std::make_pair(itemVS, slot);
353
355 item->deleteFromDB();
356 }
357
358 int64_t cost = depositCount * VOID_STORAGE_STORE_ITEM;
359
360 player->modCoinage(-cost);
361
363 uint8_t withdrawCount = 0;
364 for (std::vector<ObjectGuid>::iterator itr = itemIds.begin(); itr != itemIds.end(); ++itr)
365 {
366 uint8_t slot;
367 VoidStorageItem* itemVS = player->getVoidStorageItem(*itr, slot);
368 if (!itemVS)
369 {
370 sLogger.debug("handleVoidStorageTransfer - Player (GUID: {}, name: {}) tried to withdraw an invalid item (id: %I64u)", player->getGuidLow(), player->getName(), uint64_t(*itr));
371 continue;
372 }
373
374 auto itemHolder = sObjectMgr.createItem(itemVS->itemEntry, player);
375
376 auto* item = itemHolder.get();
377 const auto [msg, _] = player->getItemInterface()->AddItemToFreeSlot(std::move(itemHolder));
378 if (msg != ADD_ITEM_RESULT_OK)
379 {
381 sLogger.debug("handleVoidStorageTransfer - Player (GUID: {}, name: {}) couldn't withdraw item id %I64u because inventory was full.", player->getGuidLow(), player->getName(), uint64_t(*itr));
382 return;
383 }
384
385 item->setCreatorGuid(uint64_t(itemVS->creatorGuid));
387
388 withdrawItems[withdrawCount++] = *itemVS;
389
390 player->deleteVoidStorageItem(slot);
391 }
392
393 WorldPacket data(SMSG_VOID_STORAGE_TRANSFER_CHANGES, ((5 + 5 + (7 + 7) * depositCount +
394 7 * withdrawCount) / 8) + 7 * withdrawCount + (7 + 7 + 4 * 4) * depositCount);
395
396 data.writeBits(depositCount, 5);
397 data.writeBits(withdrawCount, 5);
398
399 for (uint8_t i = 0; i < depositCount; ++i)
400 {
401 ObjectGuid itemId = depositItems[i].first.itemId;
402 ObjectGuid creatorGuid = depositItems[i].first.creatorGuid;
403 data.writeBit(creatorGuid[7]);
404 data.writeBit(itemId[7]);
405 data.writeBit(itemId[4]);
406 data.writeBit(creatorGuid[6]);
407 data.writeBit(creatorGuid[5]);
408 data.writeBit(itemId[3]);
409 data.writeBit(itemId[5]);
410 data.writeBit(creatorGuid[4]);
411 data.writeBit(creatorGuid[2]);
412 data.writeBit(creatorGuid[0]);
413 data.writeBit(creatorGuid[3]);
414 data.writeBit(creatorGuid[1]);
415 data.writeBit(itemId[2]);
416 data.writeBit(itemId[0]);
417 data.writeBit(itemId[1]);
418 data.writeBit(itemId[6]);
419 }
420
421 for (uint8_t i = 0; i < withdrawCount; ++i)
422 {
423 ObjectGuid itemId = withdrawItems[i].itemId;
424 data.writeBit(itemId[1]);
425 data.writeBit(itemId[7]);
426 data.writeBit(itemId[3]);
427 data.writeBit(itemId[5]);
428 data.writeBit(itemId[6]);
429 data.writeBit(itemId[2]);
430 data.writeBit(itemId[4]);
431 data.writeBit(itemId[0]);
432 }
433
434 data.flushBits();
435
436 for (uint8_t i = 0; i < withdrawCount; ++i)
437 {
438 ObjectGuid itemId = withdrawItems[i].itemId;
439 data.WriteByteSeq(itemId[3]);
440 data.WriteByteSeq(itemId[1]);
441 data.WriteByteSeq(itemId[0]);
442 data.WriteByteSeq(itemId[2]);
443 data.WriteByteSeq(itemId[7]);
444 data.WriteByteSeq(itemId[5]);
445 data.WriteByteSeq(itemId[6]);
446 data.WriteByteSeq(itemId[4]);
447 }
448
449 for (uint8_t i = 0; i < depositCount; ++i)
450 {
451 ObjectGuid itemId = depositItems[i].first.itemId;
452 ObjectGuid creatorGuid = depositItems[i].first.creatorGuid;
453
454 data << uint32_t(depositItems[i].first.itemSuffixFactor);
455
456 data.WriteByteSeq(itemId[6]);
457 data.WriteByteSeq(itemId[4]);
458 data.WriteByteSeq(creatorGuid[4]);
459 data.WriteByteSeq(itemId[2]);
460 data.WriteByteSeq(creatorGuid[1]);
461 data.WriteByteSeq(creatorGuid[3]);
462 data.WriteByteSeq(itemId[3]);
463 data.WriteByteSeq(creatorGuid[0]);
464 data.WriteByteSeq(itemId[0]);
465 data.WriteByteSeq(creatorGuid[6]);
466 data.WriteByteSeq(itemId[5]);
467 data.WriteByteSeq(creatorGuid[5]);
468 data.WriteByteSeq(creatorGuid[7]);
469
470 data << uint32_t(depositItems[i].first.itemEntry);
471
472 data.WriteByteSeq(itemId[1]);
473
474 data << uint32_t(depositItems[i].second); // slot
475
476 data.WriteByteSeq(creatorGuid[2]);
477 data.WriteByteSeq(itemId[7]);
478
479 data << uint32_t(depositItems[i].first.itemRandomPropertyId);
480 }
481
482 SendPacket(&data);
483
485
486 player->saveVoidStorage();
487#endif
488}
#define VOID_STORAGE_STORE_ITEM
#define VOID_STORAGE_MAX_DEPOSIT
@ VOID_TRANSFER_ERROR_NO_ERROR
@ VOID_TRANSFER_ERROR_FULL
@ VOID_TRANSFER_ERROR_NOT_ENOUGH_MONEY
@ VOID_TRANSFER_ERROR_INVENTORY_FULL
#define VOID_STORAGE_MAX_WITHDRAW
@ SMSG_VOID_STORAGE_TRANSFER_CHANGES
Definition Opcodes.hpp:1757
uint64_t getCreatorGuid() const
Definition Item.cpp:137
void setCreatorGuid(uint64_t guid)
Definition Item.cpp:138
uint32_t getRandomPropertiesId() const
Definition Item.cpp:209
uint32_t getPropertySeed() const
Definition Item.cpp:202
void sendVoidStorageTransferResult(uint8_t result)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleVoidStorageUnlock()

void WorldSession::handleVoidStorageUnlock ( WorldPacket recvData)

Definition at line 26 of file VoidStorageHandler.cpp.

27{
28#if VERSION_STRING >= Cata
29 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_VOID_STORAGE_UNLOCK");
30
31 Player* player = GetPlayer();
32
33 ObjectGuid npcGuid;
34 npcGuid[4] = recvData.readBit();
35 npcGuid[5] = recvData.readBit();
36 npcGuid[3] = recvData.readBit();
37 npcGuid[0] = recvData.readBit();
38 npcGuid[2] = recvData.readBit();
39 npcGuid[1] = recvData.readBit();
40 npcGuid[7] = recvData.readBit();
41 npcGuid[6] = recvData.readBit();
42
43 recvData.ReadByteSeq(npcGuid[7]);
44 recvData.ReadByteSeq(npcGuid[1]);
45 recvData.ReadByteSeq(npcGuid[2]);
46 recvData.ReadByteSeq(npcGuid[3]);
47 recvData.ReadByteSeq(npcGuid[5]);
48 recvData.ReadByteSeq(npcGuid[0]);
49 recvData.ReadByteSeq(npcGuid[6]);
50 recvData.ReadByteSeq(npcGuid[4]);
51
52 Creature* creature = player->getWorldMapCreature(npcGuid);
53 if (!creature)
54 {
55 sLogger.debug("handleVoidStorageUnlock - Unit (GUID: {}) not found.", uint64_t(npcGuid));
56 return;
57 }
58
59 // Validate
60 if (!creature->isVoidStorage() && creature->getDistance(player) > 5.0f)
61 {
62 sLogger.debug("handleVoidStorageUnlock - Unit (GUID: {}) can't interact with it or is no Void Storage.", uint64_t(npcGuid));
63 return;
64 }
65
66 if (player->isVoidStorageUnlocked())
67 {
68 sLogger.debug("handleVoidStorageUnlock - Player (GUID: {}, name: {}) tried to unlock void storage a 2nd time.", player->getGuidLow(), player->getName());
69 return;
70 }
71
72 player->modCoinage(-int64_t(VOID_STORAGE_UNLOCK));
73 player->unlockVoidStorage();
74#endif
75}
#define VOID_STORAGE_UNLOCK
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleVoidSwapItem()

void WorldSession::handleVoidSwapItem ( WorldPacket recvData)

Definition at line 490 of file VoidStorageHandler.cpp.

491{
492#if VERSION_STRING >= Cata
493 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_VOID_SWAP_ITEM");
494
495 Player* player = GetPlayer();
496 uint32_t newSlot;
497 ObjectGuid npcGuid;
498 ObjectGuid itemId;
499
500 recvData >> newSlot;
501
502 npcGuid[2] = recvData.readBit();
503 npcGuid[4] = recvData.readBit();
504 npcGuid[0] = recvData.readBit();
505 itemId[2] = recvData.readBit();
506 itemId[6] = recvData.readBit();
507 itemId[5] = recvData.readBit();
508 npcGuid[1] = recvData.readBit();
509 npcGuid[7] = recvData.readBit();
510 itemId[3] = recvData.readBit();
511 itemId[7] = recvData.readBit();
512 itemId[0] = recvData.readBit();
513 npcGuid[6] = recvData.readBit();
514 npcGuid[5] = recvData.readBit();
515 npcGuid[3] = recvData.readBit();
516 itemId[1] = recvData.readBit();
517 itemId[4] = recvData.readBit();
518
519 recvData.ReadByteSeq(npcGuid[1]);
520 recvData.ReadByteSeq(itemId[3]);
521 recvData.ReadByteSeq(itemId[2]);
522 recvData.ReadByteSeq(itemId[4]);
523 recvData.ReadByteSeq(npcGuid[3]);
524 recvData.ReadByteSeq(npcGuid[0]);
525 recvData.ReadByteSeq(itemId[6]);
526 recvData.ReadByteSeq(itemId[1]);
527 recvData.ReadByteSeq(npcGuid[5]);
528 recvData.ReadByteSeq(itemId[5]);
529 recvData.ReadByteSeq(npcGuid[6]);
530 recvData.ReadByteSeq(itemId[0]);
531 recvData.ReadByteSeq(npcGuid[2]);
532 recvData.ReadByteSeq(npcGuid[7]);
533 recvData.ReadByteSeq(npcGuid[4]);
534 recvData.ReadByteSeq(itemId[7]);
535
536 Creature* creature = player->getWorldMapCreature(npcGuid);
537 if (!creature)
538 {
539 sLogger.debug("handleVoidSwapItem - Unit (GUID: {}) not found.", uint64_t(npcGuid));
540 return;
541 }
542
543 // Validate
544 if (!creature->isVoidStorage() && creature->getDistance(player) > 5.0f)
545 {
546 sLogger.debug("handleVoidSwapItem - Unit (GUID: {}) can't interact with it or is no Void Storage.", uint64_t(npcGuid));
547 return;
548 }
549
550 if (!player->isVoidStorageUnlocked())
551 {
552 sLogger.debug("handleVoidSwapItem - Player (GUID: {}, name: {}) queried void storage without unlocking it.", player->getGuidLow(), player->getName());
553 return;
554 }
555
556 uint8_t oldSlot;
557 if (!player->getVoidStorageItem(itemId, oldSlot))
558 {
559 sLogger.debug("handleVoidSwapItem - Player (GUID: {}, name: {}) requested swapping an invalid item (slot: {}, itemid: %I64u).", player->getGuidLow(), player->getName(), newSlot, uint64_t(itemId));
560 return;
561 }
562
563 bool usedSrcSlot = player->getVoidStorageItem(oldSlot) != nullptr; // should be always true
564 bool usedDestSlot = player->getVoidStorageItem(newSlot) != nullptr;
565 ObjectGuid itemIdDest;
566 if (usedDestSlot)
567 itemIdDest = player->getVoidStorageItem(newSlot)->itemId;
568
569 if (!player->swapVoidStorageItem(oldSlot, newSlot))
570 {
572 return;
573 }
574
575 WorldPacket data(SMSG_VOID_ITEM_SWAP_RESPONSE, 1 + (usedSrcSlot + usedDestSlot) * (1 + 7 + 4));
576
577 data.writeBit(!usedDestSlot);
578 data.writeBit(!usedSrcSlot);
579
580 if (usedSrcSlot)
581 {
582 data.writeBit(itemId[5]);
583 data.writeBit(itemId[2]);
584 data.writeBit(itemId[1]);
585 data.writeBit(itemId[4]);
586 data.writeBit(itemId[0]);
587 data.writeBit(itemId[6]);
588 data.writeBit(itemId[7]);
589 data.writeBit(itemId[3]);
590 }
591
592 data.writeBit(!usedDestSlot); // unk
593
594 if (usedDestSlot)
595 {
596 data.writeBit(itemIdDest[7]);
597 data.writeBit(itemIdDest[3]);
598 data.writeBit(itemIdDest[4]);
599 data.writeBit(itemIdDest[0]);
600 data.writeBit(itemIdDest[5]);
601 data.writeBit(itemIdDest[1]);
602 data.writeBit(itemIdDest[2]);
603 data.writeBit(itemIdDest[6]);
604 }
605
606 data.writeBit(!usedSrcSlot); // unk
607
608 data.flushBits();
609
610 if (usedDestSlot)
611 {
612 data.WriteByteSeq(itemIdDest[4]);
613 data.WriteByteSeq(itemIdDest[6]);
614 data.WriteByteSeq(itemIdDest[5]);
615 data.WriteByteSeq(itemIdDest[2]);
616 data.WriteByteSeq(itemIdDest[3]);
617 data.WriteByteSeq(itemIdDest[1]);
618 data.WriteByteSeq(itemIdDest[7]);
619 data.WriteByteSeq(itemIdDest[0]);
620 }
621
622 if (usedSrcSlot)
623 {
624 data.WriteByteSeq(itemId[6]);
625 data.WriteByteSeq(itemId[3]);
626 data.WriteByteSeq(itemId[5]);
627 data.WriteByteSeq(itemId[0]);
628 data.WriteByteSeq(itemId[1]);
629 data.WriteByteSeq(itemId[2]);
630 data.WriteByteSeq(itemId[4]);
631 data.WriteByteSeq(itemId[7]);
632 }
633
634 if (usedDestSlot)
635 data << uint32_t(oldSlot);
636
637 if (usedSrcSlot)
638 data << uint32_t(newSlot);
639
640 SendPacket(&data);
641
642 player->saveVoidStorage();
643#endif
644}
@ VOID_TRANSFER_ERROR_INTERNAL_ERROR_1
@ SMSG_VOID_ITEM_SWAP_RESPONSE
Definition Opcodes.hpp:1754
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleWhoIsOpcode()

void WorldSession::handleWhoIsOpcode ( WorldPacket recvPacket)
protected

Definition at line 1726 of file MiscHandler.cpp.

1727{
1728 CmsgWhoIs srlPacket;
1729 if (!srlPacket.deserialise(recvPacket))
1730 return;
1731
1732 sLogger.debug("Received WHOIS command from player {} for character {}", _player->getName(), srlPacket.characterName);
1733
1734 if (!_player->getSession()->CanUseCommand('3'))
1735 {
1736 SendNotification("You do not have permission to perform that function.");
1737 return;
1738 }
1739
1740 if (srlPacket.characterName.empty())
1741 {
1742 SendNotification("You did not enter a character name!");
1743 return;
1744 }
1745
1746 auto resultAcctId = CharacterDatabase.Query("SELECT acct FROM characters WHERE name = '%s'", srlPacket.characterName.c_str());
1747 if (!resultAcctId)
1748 {
1749 SendNotification("%s does not exit!", srlPacket.characterName.c_str());
1750 return;
1751 }
1752
1753 Field* fields_acctID = resultAcctId->Fetch();
1754 const uint32_t accId = fields_acctID[0].asUint32();
1755
1756 //todo: this will not work! no table accounts in character_db!!!
1757 auto accountInfoResult = CharacterDatabase.Query("SELECT acct, login, gm, email, lastip, muted FROM accounts WHERE acct = %u", accId);
1758 if (!accountInfoResult)
1759 {
1760 SendNotification("Account information for %s not found!", srlPacket.characterName.c_str());
1761 return;
1762 }
1763
1764 Field* fields = accountInfoResult->Fetch();
1765 std::string acctID = fields[0].asCString();
1766 if (acctID.empty())
1767 acctID = "Unknown";
1768
1769 std::string acctName = fields[1].asCString();
1770 if (acctName.empty())
1771 acctName = "Unknown";
1772
1773 std::string acctPerms = fields[2].asCString();
1774 if (acctPerms.empty())
1775 acctPerms = "Unknown";
1776
1777 std::string acctEmail = fields[3].asCString();
1778 if (acctEmail.empty())
1779 acctEmail = "Unknown";
1780
1781 std::string acctIP = fields[4].asCString();
1782 if (acctIP.empty())
1783 acctIP = "Unknown";
1784
1785 std::string acctMuted = fields[5].asCString();
1786 if (acctMuted.empty())
1787 acctMuted = "Unknown";
1788
1789 std::string msg = srlPacket.characterName + "'s " + "account information: acctID: " + acctID + ", Name: "
1790 + acctName + ", Permissions: " + acctPerms + ", E-Mail: " + acctEmail + ", lastIP: " + acctIP + ", Muted: " + acctMuted;
1791
1792 WorldPacket data(SMSG_WHOIS, msg.size() + 1);
1793 data << msg;
1794 SendPacket(&data);
1795}
@ SMSG_WHOIS
Definition Opcodes.hpp:137
bool CanUseCommand(char cmdstr)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleWhoOpcode()

void WorldSession::handleWhoOpcode ( WorldPacket recvPacket)
protected

Definition at line 95 of file MiscHandler.cpp.

96{
97 CmsgWho srlPacket;
98 if (!srlPacket.deserialise(recvPacket))
99 {
100 return;
101 }
102
103 bool const hasCharName = !srlPacket.player_name.empty();
104 bool const hasGuildName = !srlPacket.guild_name.empty();
105
106 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Received CMSG_WHO with {} zones and {} names", srlPacket.zone_count, srlPacket.name_count);
107
108 PlayerTeam const team = _player->getTeam();
109
110 uint32_t sent_count = 0;
111 uint32_t total_count = 0;
112
113 WorldPacket data;
114 data.SetOpcode(SMSG_WHO);
115 data << uint64_t(0);
116
117 sObjectMgr.m_playerLock.lock();
118
119 for (auto const& itr : sObjectMgr.getPlayerStorage())
120 {
121 Player* player = itr.second;
122 if (player == nullptr || player->getSession() == nullptr || !player->IsInWorld())
123 {
124 continue;
125 }
126
127 if (!worldConfig.gm.showGmInWhoList && !HasGMPermissions() && player->getSession()->HasGMPermissions())
128 {
129 continue;
130 }
131
132 // Team check
133 if (!HasGMPermissions() && player->getTeam() != team && !player->getSession()->HasGMPermissions() && !worldConfig.player.isInterfactionMiscEnabled)
134 {
135 continue;
136 }
137
138 ++total_count;
139
140 // Chat name
141 if (hasCharName && srlPacket.player_name.compare(player->getName()) != 0)
142 {
143 continue;
144 }
145
146 // Guild name
147 if (hasGuildName && (!player->getGuild() || srlPacket.guild_name.compare(player->getGuild()->getName()) != 0))
148 {
149 continue;
150 }
151
152 // Level check
153 // skip players outside of level range
154 if (srlPacket.min_level > 0 && srlPacket.max_level > 0 && player->getLevel() < srlPacket.min_level || player->getLevel() > srlPacket.max_level)
155 {
156 continue;
157 }
158
159 // Zone id compare
160 if (srlPacket.zone_count > 0)
161 {
162 // people that fail the zone check don't get added
163 bool skip = true;
164 for (uint32_t i = 0; i < srlPacket.zone_count; ++i)
165 {
166 if (srlPacket.zones[i] == player->getZoneId())
167 {
168 skip = false;
169 break;
170 }
171 }
172
173 if (skip)
174 {
175 continue;
176 }
177 }
178
179 if (((srlPacket.class_mask >> 1) & player->getClassMask()) == 0 || ((srlPacket.race_mask >> 1) & player->getRaceMask()) == 0)
180 {
181 continue;
182 }
183
184 if (srlPacket.name_count > 0)
185 {
186 // people that fail name check don't get added
187 bool skip = true;
188 for (uint32_t i = 0; i < srlPacket.name_count; ++i)
189 {
190 if (AscEmu::Util::Strings::isEqual(srlPacket.names[i].c_str(), player->getName().c_str()))
191 {
192 skip = false;
193 break;
194 }
195 }
196
197 if (skip)
198 {
199 continue;
200 }
201 }
202
203 // if we're here, it means we've passed all tests
204 data << player->getName().c_str();
205
206 if (player->m_playerInfo->m_guild > 0)
207 {
208 data << sGuildMgr.getGuildById(player->m_playerInfo->m_guild)->getName().c_str();
209 }
210 else
211 {
212 data << uint8_t(0);
213 }
214
215 data << player->getLevel();
216 data << uint32_t(player->getClass());
217 data << uint32_t(player->getRace());
218 data << player->getGender();
219 data << uint32_t(player->getZoneId());
220
221 ++sent_count;
222 if (sent_count >= 49)
223 {
224 break;
225 }
226 }
227
228 sObjectMgr.m_playerLock.unlock();
229 data.wpos(0);
230 data << sent_count;
231 data << sent_count;
232
233 SendPacket(&data);
234}
@ SMSG_WHO
Definition Opcodes.hpp:135
PlayerTeam
uint32_t zones[10]
Definition CmsgWho.h:27
std::string player_name
Definition CmsgWho.h:24
std::string names[4]
Definition CmsgWho.h:28
std::string guild_name
Definition CmsgWho.h:25
size_t wpos()
Definition ByteBuffer.h:422
uint8_t getGender() const
Definition Unit.cpp:459
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleWorldStateUITimerUpdate()

void WorldSession::handleWorldStateUITimerUpdate ( WorldPacket )
protected

Definition at line 457 of file MiscHandler.cpp.

458{
459#if VERSION_STRING > TBC
460 SendPacket(SmsgWorldStateUiTimerUpdate(static_cast<uint32_t>(UNIXTIME)).serialise().get());
461#endif
462}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleWorldTeleportOpcode()

void WorldSession::handleWorldTeleportOpcode ( WorldPacket recvPacket)
protected

Definition at line 556 of file MovementHandler.cpp.

557{
558 CmsgWorldTeleport srlPacket;
559 if (!srlPacket.deserialise(recvPacket))
560 return;
561
562 if (!HasGMPermissions())
563 {
564 SendNotification("You do not have permission to use this function.");
565 return;
566 }
567
568 _player->safeTeleport(srlPacket.mapId, 0, srlPacket.location);
569}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleWrapItemOpcode()

void WorldSession::handleWrapItemOpcode ( WorldPacket recvPacket)
protected

Definition at line 2924 of file ItemHandler.cpp.

2925{
2926 CmsgWrapItem srlPacket;
2927 if (!srlPacket.deserialise(recvPacket))
2928 return;
2929
2930 Item* src = _player->getItemInterface()->GetInventoryItem(srlPacket.srcBagSlot, srlPacket.srcSlot);
2931 Item* dst = _player->getItemInterface()->GetInventoryItem(srlPacket.destBagSlot, srlPacket.destSlot);
2932
2933 if (!src || !dst)
2934 return;
2935
2936 if (src == dst || !(src->getItemProperties()->Class == 0 && src->getItemProperties()->SubClass == 8))
2937 {
2939 return;
2940 }
2941
2942 if (dst->getStackCount() > 1)
2943 {
2945 return;
2946 }
2947
2948 uint32_t dstItemMaxStack = dst->getOwner()->m_cheats.hasItemStackCheat ? 0x7fffffff : dst->getItemProperties()->MaxCount;
2949 if (dstItemMaxStack > 1)
2950 {
2952 return;
2953 }
2954
2955 if (dst->isSoulbound())
2956 {
2958 return;
2959 }
2960
2961 if (dst->m_wrappedItemId || src->m_wrappedItemId)
2962 {
2964 return;
2965 }
2966
2967 if (dst->getItemProperties()->Unique)
2968 {
2970 return;
2971 }
2972
2973 if (dst->isContainer())
2974 {
2976 return;
2977 }
2978
2979 if (dst->hasEnchantments())
2980 {
2982 return;
2983 }
2984 if (srlPacket.destBagSlot == -1
2985 && (srlPacket.destSlot >= int8_t(EQUIPMENT_SLOT_START)
2986 && srlPacket.destSlot <= int8_t(INVENTORY_SLOT_BAG_END)))
2987 {
2989 return;
2990 }
2991
2992 // all checks passed ok
2993 uint32_t source_entry = src->getEntry();
2994 uint32_t itemid = source_entry;
2995 switch (source_entry)
2996 {
2997 case 5042:
2998 itemid = 5043;
2999 break;
3000 case 5048:
3001 itemid = 5044;
3002 break;
3003 case 17303:
3004 itemid = 17302;
3005 break;
3006 case 17304:
3007 itemid = 17305;
3008 break;
3009 case 17307:
3010 itemid = 17308;
3011 break;
3012 case 21830:
3013 itemid = 21831;
3014 break;
3015 default:
3017 return;
3018 }
3019
3021
3022 if (src->getStackCount() <= 1)
3023 {
3024 // destroy the source item
3026 }
3027 else
3028 {
3029 // reduce stack count by one
3030 src->modStackCount(-1);
3031 src->m_isDirty = true;
3032 }
3033
3034 // change the dest item's entry
3035 dst->m_wrappedItemId = dst->getEntry();
3036 dst->setEntry(itemid);
3037
3038 // set the giftwrapper fields
3040 dst->setDurability(0);
3041 dst->setMaxDurability(0);
3043
3044 // save it
3045 dst->m_isDirty = true;
3046 dst->saveToDB(srlPacket.destBagSlot, srlPacket.destSlot, false, nullptr);
3047}
@ ITEM_FLAG_WRAPPED
@ INV_ERR_WRAPPED_CANT_BE_WRAPPED
@ INV_ERR_STACKABLE_CANT_BE_WRAPPED
@ INV_ERR_BAGS_CANT_BE_WRAPPED
@ INV_ERR_UNIQUE_CANT_BE_WRAPPED
@ INV_ERR_EQUIPPED_CANT_BE_WRAPPED
@ INV_ERR_BOUND_CANT_BE_WRAPPED
bool hasEnchantments()
Definition Item.hpp:130
void setMaxDurability(uint32_t maxDurability)
Definition Item.cpp:220
void setDurability(uint32_t durability)
Definition Item.cpp:217
void setItemProperties(ItemProperties const *itemProperties)
Definition Item.cpp:955
void setEntry(uint32_t entry)
Definition Object.cpp:383
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleZoneupdate()

void WorldSession::handleZoneupdate ( WorldPacket recvPacket)
protected

Definition at line 762 of file MiscHandler.cpp.

763{
764 CmsgZoneupdate srlPacket;
765 if (!srlPacket.deserialise(recvPacket))
766 return;
767
768 if (_player->getZoneId() == srlPacket.zoneId)
769 return;
770
771 sWeatherMgr.sendWeather(_player);
772 _player->zoneUpdate(srlPacket.zoneId);
774}
#define sWeatherMgr
void zoneUpdate(uint32_t zoneId)
Definition Player.cpp:2097
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HasFlag()

bool WorldSession::HasFlag ( uint32_t  flag)
inline

Definition at line 142 of file WorldSession.h.

142{ return (_accountFlags & flag) != 0; }
Here is the caller graph for this function:

◆ HasGMPermissions()

bool WorldSession::HasGMPermissions ( ) const

Definition at line 441 of file WorldSession.cpp.

442{
443 return hasPermission("a");
444}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasPermission()

bool WorldSession::hasPermission ( const char *  requiredPermission) const

Definition at line 429 of file WorldSession.cpp.

430{
431 if (requiredPermission == nullptr || permissions.empty())
432 return false;
433
434 //sLogger.info("Your permission string is \"{}\"", permissions);
435
436 if (permissions.find(requiredPermission) != std::string::npos)
437 return true;
438 return false;
439}
Here is the caller graph for this function:

◆ hasPermissions()

bool WorldSession::hasPermissions ( ) const

Definition at line 424 of file WorldSession.cpp.

425{
426 return permissions.size() > 1 ? true : false;
427}
Here is the caller graph for this function:

◆ initGMMyMaster()

void WorldSession::initGMMyMaster ( )

Definition at line 563 of file CharacterHandler.cpp.

564{
565#ifndef GM_TICKET_MY_MASTER_COMPATIBLE
566 GM_Ticket* ticket = sTicketMgr.getGMTicketByPlayer(_player->getGuid());
567 if (ticket)
568 {
569 //Send status change to gm_sync_channel
570 const auto channel = sChannelMgr.getChannel(sWorld.getGmClientChannel(), _player);
571 if (channel)
572 {
573 std::stringstream ss;
574 ss << "GmTicket:" << GM_TICKET_CHAT_OPCODE_ONLINESTATE;
575 ss << ":" << ticket->guid;
576 ss << ":1";
577 channel->Say(_player, ss.str().c_str(), nullptr, true);
578 }
579 }
580#endif
581}
@ GM_TICKET_CHAT_OPCODE_ONLINESTATE
Definition TicketMgr.hpp:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAddonRegistered()

bool WorldSession::isAddonRegistered ( const std::string &  addon_name) const

Definition at line 2247 of file MiscHandler.cpp.

2248{
2249#if VERSION_STRING >= Cata
2251 return true;
2252
2254 return false;
2255
2256 auto itr = std::find(mRegisteredAddonPrefixesVector.begin(), mRegisteredAddonPrefixesVector.end(), addon_name);
2257 return itr != mRegisteredAddonPrefixesVector.end();
2258#else
2259 return false;
2260#endif
2261}

◆ isFloodProtectionTriggered()

bool WorldSession::isFloodProtectionTriggered ( )

Definition at line 57 of file ChatHandler.cpp.

58{
59 if (!hasPermissions() && worldConfig.chat.linesBeforeProtection)
60 {
61 if (UNIXTIME >= floodTime)
62 {
63 floodLines = 0;
64 floodTime = UNIXTIME + worldConfig.chat.secondsBeforeProtectionReset;
65 }
66
67 if ((++floodLines) > worldConfig.chat.linesBeforeProtection)
68 {
69 if (worldConfig.chat.enableSendFloodProtectionMessage)
70 {
71 _player->broadcastMessage("Your message has triggered serverside flood protection. You can speak again in %ld seconds.",
73 }
74 return true;
75 }
76 }
77
78 return false;
79}
void broadcastMessage(const char *Format,...)
Definition Player.cpp:6552
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isHackDetectedInMovementData()

bool WorldSession::isHackDetectedInMovementData ( uint16_t  opcode)
protected

Definition at line 108 of file MovementHandler.cpp.

109{
110 // NOTE: All this stuff is probably broken. However, if you want to implement hack detection, here is the place for it ;)
111 // We have activated gm mode - we can hack as much as we want ;)
112 // Zyres: it is not helpfull to check for permission count right now
113 if (_player->hasPlayerFlags(PLAYER_FLAG_GM) && worldConfig.antiHack.isAntiHackCheckDisabledForGm)
114 return false;
115
116 // Double Jump
117 if (opcode == MSG_MOVE_JUMP && _player->m_isJumping)
118 {
119 sCheatLog.writefromsession(this, "Detected jump hacking");
120 return true;
121 }
122
123 // Teleport
124 // implement worldConfig.antiHack.isTeleportHackCheckEnabled
125 if (_player->m_position.Distance2DSq({ sessionMovementInfo.position.x, sessionMovementInfo.position.y }) > 3025.0f &&
127 {
128 sCheatLog.writefromsession(this, "Disconnected for teleport hacking. Player speed: %f, Distance traveled: %f",
130 std::sqrt(_player->m_position.Distance2DSq({ sessionMovementInfo.position.x, sessionMovementInfo.position.y })));
131
132 return true;
133 }
134
135 // Speed
136 // implement worldConfig.antiHack.isSpeedHackCkeckEnabled
138 {
139 // simplified: just take the fastest speed. less chance of fuckups too
140 // get the "normal speeds" not the changed ones!
142
144
145 if (_player->m_speedCheatDetector->IsCheatDetected())
146 {
147 _player->m_speedCheatDetector->ReportCheater(_player);
148 return true;
149 }
150 }
151
152 return false;
153}
@ MSG_MOVE_JUMP
Definition Opcodes.hpp:224
bool m_isJumping
Definition Player.hpp:622
uint32_t m_flyingAura
Definition Player.hpp:2177
std::unique_ptr< SpeedCheatDetector > m_speedCheatDetector
Definition Player.hpp:1575
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsLoggingOut()

bool WorldSession::IsLoggingOut ( )
inline

Definition at line 226 of file WorldSession.h.

226{ return _loggingOut; }
Here is the caller graph for this function:

◆ isSessionMuted()

bool WorldSession::isSessionMuted ( )

Definition at line 46 of file ChatHandler.cpp.

47{
48 if (m_muted && m_muted >= static_cast<uint32_t>(UNIXTIME))
49 {
50 SystemMessage("Your voice is currently muted by a moderator.");
51 return true;
52 }
53
54 return false;
55}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadAccountDataProc()

void WorldSession::loadAccountDataProc ( QueryResult result)

Definition at line 957 of file CharacterHandler.cpp.

958{
959 if (result == nullptr)
960 {
961 CharacterDatabase.Execute("INSERT INTO account_data VALUES(%u, '', '', '', '', '', '', '', '', '')", _accountId);
962 return;
963 }
964
965 for (uint8_t i = 0; i < 7; ++i)
966 {
967 const char* accountData = result->Fetch()[1 + i].asCString();
968 const size_t length = accountData ? strlen(accountData) : 0;
969 if (length > 1)
970 {
971 auto d = std::make_unique<char[]>(length + 1);
972 memcpy(d.get(), accountData, length + 1);
973 SetAccountData(i, std::move(d), true, static_cast<uint32_t>(length));
974 }
975 }
976}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadPlayerFromDBProc()

void WorldSession::loadPlayerFromDBProc ( QueryResultVector results)

Definition at line 267 of file CharacterHandler.cpp.

268{
269 if (results.empty())
270 {
272 return;
273 }
274
275 QueryResult* result = results[0].result.get();
276 if (result == nullptr)
277 {
279 return;
280 }
281
282 Field* fields = result->Fetch();
283 const uint32_t playerGuid = fields[0].asUint32();
284 const uint8_t _class = fields[1].asUint8();
285
286 Player* player = sObjectMgr.createPlayerByGuid(_class, playerGuid);
287
288 if (player == nullptr)
289 {
290 sLogger.failure("Unknown class {}!", _class);
292 return;
293 }
294
295 player->setSession(this);
296 m_bIsWLevelSet = false;
297
298 sLogger.debug("Async loading player {}", static_cast<uint32_t>(playerGuid));
299 m_loggingInPlayer = player;
300 player->loadFromDB(playerGuid);
301}
@ E_CHAR_LOGIN_NO_CHARACTER
bool loadFromDB(uint32_t guid)
Definition Player.cpp:14525
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LoadSecurity()

void WorldSession::LoadSecurity ( std::string  securitystring)

Definition at line 410 of file WorldSession.cpp.

411{
412 permissions = securitystring;
413
414 sLogger.debug("Loaded permissions for {}. [{}]", this->GetAccountId(), permissions);
415}
Here is the call graph for this function:

◆ LocalizedBroadCast()

const char * WorldSession::LocalizedBroadCast ( uint32_t  id)

Definition at line 649 of file WorldSession.cpp.

650{
651 MySQLStructure::WorldBroadCast const* wb = sMySQLStore.getWorldBroadcastById(id);
652 if (!wb)
653 {
654 memset(szError, 0, 64);
655 sprintf(szError, "ID:%u is a invalid WorldBroadCast message!", id);
656 return szError;
657 }
658
659 MySQLStructure::LocalesWorldbroadcast const* lpi = (language > 0) ? sMySQLStore.getLocalizedWorldbroadcast(id, language) : nullptr;
660 if (lpi)
661 {
662 return lpi->text;
663 }
664 else
665 {
666 return wb->text.c_str();
667 }
668}
char szError[64]

◆ LocalizedGossipOption()

const char * WorldSession::LocalizedGossipOption ( uint32_t  id)

Definition at line 584 of file WorldSession.cpp.

585{
586 MySQLStructure::GossipMenuOption const* wst = sMySQLStore.getGossipMenuOption(id);
587 if (!wst)
588 {
589 memset(szError, 0, 64);
590 sprintf(szError, "ID:%u is a bad GossipMenuOption TEXT!", id);
591 return szError;
592 }
593
594 MySQLStructure::LocalesGossipMenuOption const* lpi = (language > 0) ? sMySQLStore.getLocalizedGossipMenuOption(id, language) : nullptr;
595 if (lpi != nullptr)
596 {
597 return lpi->name;
598 }
599 else
600 {
601 return wst->text.c_str();
602 }
603}
Here is the caller graph for this function:

◆ LocalizedMapName()

const char * WorldSession::LocalizedMapName ( uint32_t  id)

Definition at line 628 of file WorldSession.cpp.

629{
630 MySQLStructure::MapInfo const* mi = sMySQLStore.getWorldMapInfo(id);
631 if (!mi)
632 {
633 memset(szError, 0, 64);
634 sprintf(szError, "ID:%u still have no map title yet!", id);
635 return szError;
636 }
637
638 MySQLStructure::LocalesWorldmapInfo const* lpi = (language > 0) ? sMySQLStore.getLocalizedWorldmapInfo(id, language) : nullptr;
639 if (lpi != nullptr)
640 {
641 return lpi->text;
642 }
643 else
644 {
645 return mi->name.c_str();
646 }
647}

◆ LocalizedWorldSrv()

const char * WorldSession::LocalizedWorldSrv ( uint32_t  id)

Definition at line 607 of file WorldSession.cpp.

608{
609 MySQLStructure::WorldStringTable const* wst = sMySQLStore.getWorldString(id);
610 if (!wst)
611 {
612 memset(szError, 0, 64);
613 sprintf(szError, "ID:%u is a bad WorldString TEXT!", id);
614 return szError;
615 }
616
617 MySQLStructure::LocalesWorldStringTable const* lpi = (language > 0) ? sMySQLStore.getLocalizedWorldStringTable(id, language) : nullptr;
618 if (lpi != nullptr)
619 {
620 return lpi->text;
621 }
622 else
623 {
624 return wst->text.c_str();
625 }
626}
Here is the caller graph for this function:

◆ LogoutPlayer()

void WorldSession::LogoutPlayer ( bool  Save)

Definition at line 213 of file WorldSession.cpp.

214{
215 Player* pPlayer = _player;
216
217 if (_loggingOut)
218 return;
219
220 _loggingOut = true;
221 m_loginTime = 0;
222
223 if (_player != nullptr)
224 {
226
227 sObjectMgr.removePlayer(_player);
229
230 sHookInterface.OnLogout(pPlayer);
233
235 {
237 if (obj != nullptr)
238 {
239 switch (obj->getObjectTypeId())
240 {
241 case TYPEID_UNIT:
242 {
243 if (const auto creature = dynamic_cast<Creature*>(obj))
244 creature->loot.removeLooter(_player->getGuidLow());
245 } break;
247 {
248 if (const auto go = dynamic_cast<GameObject*>(obj))
249 {
250 if (!go->IsLootable())
251 break;
252
253 if (const auto pLGO = dynamic_cast<GameObject_Lootable*>(go))
254 pLGO->loot.removeLooter(_player->getGuidLow());
255 }
256 } break;
257 }
258 }
259 }
260
261#ifndef GM_TICKET_MY_MASTER_COMPATIBLE
262 GM_Ticket* ticket = sTicketMgr.getGMTicketByPlayer(_player->getGuid());
263 if (ticket != NULL)
264 {
265 // Send status change to gm_sync_channel
266 Channel* chn = sChannelMgr.getChannel(sWorld.getGmClientChannel(), _player);
267 if (chn)
268 {
269 std::stringstream ss;
270 ss << "GmTicket:" << GM_TICKET_CHAT_OPCODE_ONLINESTATE;
271 ss << ":" << ticket->guid;
272 ss << ":0";
273 chn->Say(_player, ss.str().c_str(), NULL, true);
274 }
275 }
276#endif
277
278 // part channels
280
281 auto transport = _player->GetTransport();
282 if (transport != nullptr)
283 {
284 transport->RemovePassenger(_player);
285 }
286
287 // cancel current spell
288 for (uint8_t i = 0; i < CURRENT_SPELL_MAX; ++i)
289 {
290 if (_player->getCurrentSpell(CurrentSpellType(i)) != nullptr)
292 }
293
295
296 // Decrement the global player count
297 sWorld.decrementPlayerCount(_player->getTeam());
298
300 sBattlegroundManager.removePlayerFromQueues(_player);
301
302 // Repop or Resurrect and remove from battlegrounds
303 if (_player->m_bg)
304 {
305 if (pPlayer->getDeathState() == JUST_DIED)
306 pPlayer->setResurrect();
307 if (pPlayer->getDeathState() != ALIVE)
308 pPlayer->resurrect();
310 }
311 else if (_player->isDead() && _player->getDeathState() == JUST_DIED)
313
314 // Issue a message telling all guild members that this player signed
315 // off
316
319
320 // Save HP/Mana
323
324 // _player->SaveAuras();
325
326 if (Save)
327 _player->saveToDB(false);
328
329 // Remove pet/summons after save so current pet is properly saved
330 // Keep pet active so it will be summoned again when player logs in
333
334 // Dismounting with removeAllAuras may in certain cases add a player
335 // aura,
336 // which can result in a nice crash during shutdown. Therefore let's
337 // dismount on logout.
338 // Ofc if the player was mounted on login they will be still mounted
339 // ;)
340 _player->dismount();
341
343
345 if (_player->IsInWorld())
347
348 if (_player->m_playerInfo->m_Group != nullptr)
350
351 // Remove the "player locked" flag, to allow movement on next login
353
354 // Save Honor Points
355 // _player->SaveHonorFields();
356
357 // Update any dirty account_data fields.
358 bool dirty = false;
359
360 if (worldConfig.server.useAccountData)
361 {
362 std::stringstream ss;
363 ss << "UPDATE account_data SET ";
364 for (uint32_t ui = 0; ui < 8; ui++)
365 {
366 if (sAccountData[ui].bIsDirty)
367 {
368 if (dirty)
369 ss << ",";
370 ss << "uiconfig" << ui << "=\"";
371
372 if (sAccountData[ui].data)
373 {
374 CharacterDatabase.EscapeLongString(sAccountData[ui].data.get(), sAccountData[ui].sz, ss);
375 // ss.write(sAccountData[ui].data,sAccountData[ui].sz);
376 }
377 ss << "\"";
378 dirty = true;
379 sAccountData[ui].bIsDirty = false;
380 }
381 }
382 if (dirty)
383 {
384 ss << " WHERE acct=" << _accountId << ";";
385 CharacterDatabase.ExecuteNA(ss.str().c_str());
386 }
387 }
388
389 delete _player;
390 _player = nullptr;
391
392 SendPacket(SmsgLogoutComplete().serialise().get());
393 sLogger.debug("SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
394 }
395 _loggingOut = false;
396 LoggingOut = false;
397
399}
@ TYPEID_GAMEOBJECT
@ TYPEID_UNIT
@ DUEL_WINNER_RETREAT
@ POWER_TYPE_MANA
Definition PowerType.hpp:13
@ ALIVE
void Update()
Definition Group.cpp:199
uint8_t getObjectTypeId() const
Definition Object.cpp:566
void unSummonPetTemporarily()
Definition Player.cpp:12585
uint32_t m_loadHealth
Definition Player.hpp:730
uint32_t getInitialFactionId()
Definition Player.cpp:11812
void removeAllChannels()
Definition Player.cpp:8043
void removeFromWorld()
Definition Player.cpp:712
void setResurrect()
Definition Player.cpp:7795
bool m_isReadyToBeRemoved
Definition Player.hpp:123
uint32_t m_loadMana
Definition Player.hpp:731
void setFaction(uint32_t factionId)
Definition Unit.hpp:261
uint32_t getHealth() const
Definition Unit.cpp:481
uint32_t getPower(PowerType type) const
Definition Unit.cpp:516
void removeAllAuras()
Definition Unit.cpp:5239
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nothingToHandle()

void WorldSession::nothingToHandle ( WorldPacket recvPacket)
protected

Definition at line 675 of file WorldSession.cpp.

676{
677 if (!recv_data.isEmpty())
678 {
679 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "Opcode {} [{}] (0x{:04X}) received. Apply nothingToHandle handler but size is {}!",
680 sOpcodeTables.getNameForOpcode(recv_data.GetOpcode()), sOpcodeTables.getNameForAEVersion(), recv_data.GetOpcode(), recv_data.size());
681 }
682}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OutPacket() [1/2]

void WorldSession::OutPacket ( uint16_t  opcode)

Definition at line 698 of file WorldSession.cpp.

699{
700 if (_socket && _socket->IsConnected())
701 {
702 _socket->OutPacket(opcode, 0, nullptr);
703 }
704}
void OutPacket(uint32_t opcode, size_t len, const void *data)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OutPacket() [2/2]

void WorldSession::OutPacket ( uint16_t  opcode,
uint16_t  len,
const void *  data 
)

Definition at line 706 of file WorldSession.cpp.

707{
708 if (_socket && _socket->IsConnected())
709 {
710 _socket->OutPacket(opcode, len, data);
711 }
712}
Here is the call graph for this function:

◆ QueuePacket()

void WorldSession::QueuePacket ( std::unique_ptr< WorldPacket packet)

Definition at line 714 of file WorldSession.cpp.

715{
716 m_lastPing = static_cast<uint32_t>(UNIXTIME);
717 _recvQueue.push(std::move(packet));
718}
void push(T _element)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ readAddonInfoPacket()

void WorldSession::readAddonInfoPacket ( ByteBuffer recvPacket)

Definition at line 2067 of file MiscHandler.cpp.

2068{
2069#if VERSION_STRING >= Cata
2070 if (recvPacket.rpos() + 4 > recvPacket.size())
2071 return;
2072
2073 uint32_t recvSize;
2074 recvPacket >> recvSize;
2075
2076 if (!recvSize)
2077 return;
2078
2079 if (recvSize > 0xFFFFF)
2080 {
2081 sLogger.debug("recvSize {} too long", recvSize);
2082 return;
2083 }
2084
2085 uLongf uSize = recvSize;
2086
2087 uint32_t pos = static_cast<uint32_t>(recvPacket.rpos());
2088
2089 ByteBuffer unpackedInfo;
2090 unpackedInfo.resize(recvSize);
2091
2092 if (uncompress(unpackedInfo.contents(), &uSize, recvPacket.contents() + pos, static_cast<uLong>(recvPacket.size() - pos)) == Z_OK)
2093 {
2094 uint32_t addonsCount;
2095 unpackedInfo >> addonsCount;
2096
2097 for (uint32_t i = 0; i < addonsCount; ++i)
2098 {
2099 std::string addonName;
2100 uint8_t enabledState;
2101 uint32_t crc;
2102 uint32_t unknown;
2103
2104 if (unpackedInfo.rpos() + 1 > unpackedInfo.size())
2105 return;
2106
2107 unpackedInfo >> addonName;
2108
2109 unpackedInfo >> enabledState;
2110 unpackedInfo >> crc;
2111 unpackedInfo >> unknown;
2112
2113 sLogger.debug("AddOn: {} (CRC: 0x{:x}) - enabled: 0x{:x} - Unknown2: 0x{:x}", addonName, crc, enabledState, unknown);
2114#if VERSION_STRING < Mop
2115 AddonEntry addon(addonName, enabledState, crc, 2, true);
2116#else
2117 AddonEntry addon(addonName, true, crc, 2, enabledState);
2118#endif
2119
2120 SavedAddon const* savedAddon = sAddonMgr.getAddonInfoForAddonName(addonName);
2121 if (savedAddon)
2122 {
2123 if (addon.crc != savedAddon->crc)
2124 sLogger.debug("Addon: {}: modified (CRC: 0x{:x}) - accountID {})", addon.name, savedAddon->crc, GetAccountId());
2125 else
2126 sLogger.debug("Addon: {}: validated (CRC: 0x{:x}) - accountID {}", addon.name, savedAddon->crc, GetAccountId());
2127 }
2128 else
2129 {
2130 sAddonMgr.SaveAddon(addon);
2131 sLogger.debug("Addon: {}: unknown (CRC: 0x{:x}) - accountId {} (storing addon name and checksum to database)", addon.name, addon.crc, GetAccountId());
2132 }
2133
2134 m_addonList.push_back(addon);
2135 }
2136
2137 uint32_t addonTime;
2138 unpackedInfo >> addonTime;
2139 }
2140 else
2141 {
2142 sLogger.failure("Decompression of addon section of CMSG_AUTH_SESSION failed.");
2143 }
2144#endif
2145
2146}
#define sAddonMgr
Definition AddonMgr.h:197
AddonsList m_addonList
uint32_t crc
Definition AddonMgr.h:122
Here is the call graph for this function:

◆ registerOpcodeHandler()

void WorldSession::registerOpcodeHandler ( )
static

Definition at line 729 of file WorldSession.cpp.

730{
731 // Register opcodes using the new OpcodeHandlerRegistry
733
734 // Login
738 registry.registerOpcode<STATUS_AUTHED>(CMSG_CHAR_RENAME, &WorldSession::handleCharRenameOpcode, true, true, true, true, false);
742
743 // declined names (Cyrillic client)
745
747
749
750 // Queries
751 registry.registerOpcode(MSG_CORPSE_QUERY, &WorldSession::handleCorpseQueryOpcode, false, true, true, true, false);
752 registry.registerOpcode(CMSG_NAME_QUERY, &WorldSession::handleNameQueryOpcode, true, true, true, true, false);
753 registry.registerOpcode(CMSG_QUERY_TIME, &WorldSession::handleQueryTimeOpcode, false, true, true, true, false);
754 registry.registerOpcode(CMSG_CREATURE_QUERY, &WorldSession::handleCreatureQueryOpcode, false, true, true, true, false);
755 registry.registerOpcode(CMSG_GAMEOBJECT_QUERY, &WorldSession::handleGameObjectQueryOpcode, false, true, true, true, false);
756 registry.registerOpcode(CMSG_PAGE_TEXT_QUERY, &WorldSession::handlePageTextQueryOpcode, false, true, true, false, false);
757 registry.registerOpcode(CMSG_ITEM_NAME_QUERY, &WorldSession::handleItemNameQueryOpcode, false, true, true, false, false);
759
760 // Movement
761 registry.registerOpcode(MSG_MOVE_HEARTBEAT, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
763 registry.registerOpcode(MSG_MOVE_JUMP, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
764 registry.registerOpcode(MSG_MOVE_START_ASCEND, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
765 registry.registerOpcode(MSG_MOVE_STOP_ASCEND, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
766 registry.registerOpcode(MSG_MOVE_START_FORWARD, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
767 registry.registerOpcode(MSG_MOVE_START_BACKWARD, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
768 registry.registerOpcode(MSG_MOVE_SET_FACING, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
769 registry.registerOpcode(MSG_MOVE_START_STRAFE_LEFT, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
770 registry.registerOpcode(MSG_MOVE_START_STRAFE_RIGHT, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
771 registry.registerOpcode(MSG_MOVE_STOP_STRAFE, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
772 registry.registerOpcode(MSG_MOVE_START_TURN_LEFT, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
773 registry.registerOpcode(MSG_MOVE_START_TURN_RIGHT, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
774 registry.registerOpcode(MSG_MOVE_STOP_TURN, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
775 registry.registerOpcode(MSG_MOVE_START_PITCH_UP, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
776 registry.registerOpcode(MSG_MOVE_START_PITCH_DOWN, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
777 registry.registerOpcode(MSG_MOVE_STOP_PITCH, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
778 registry.registerOpcode(MSG_MOVE_SET_RUN_MODE, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
779 registry.registerOpcode(MSG_MOVE_SET_WALK_MODE, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
780 registry.registerOpcode(MSG_MOVE_SET_PITCH, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
781 registry.registerOpcode(MSG_MOVE_START_SWIM, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
782 registry.registerOpcode(MSG_MOVE_STOP_SWIM, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
783 registry.registerOpcode(MSG_MOVE_FALL_LAND, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
784 registry.registerOpcode(MSG_MOVE_STOP, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
785 registry.registerOpcode(CMSG_MOVE_SET_FLY, &WorldSession::handleMovementOpcodes, true, true, true, false, false);
786 registry.registerOpcode(MSG_MOVE_STOP_ASCEND, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
788 registry.registerOpcode(CMSG_SET_ACTIVE_MOVER, &WorldSession::handleSetActiveMoverOpcode, false, true, true, false, false);
789 registry.registerOpcode(CMSG_MOVE_CHNG_TRANSPORT, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
790
791 // ACK
792 registry.registerOpcode(MSG_MOVE_TELEPORT_ACK, &WorldSession::handleMoveTeleportAckOpcode, true, true, true, true, false);
798 registry.registerOpcode(CMSG_MOVE_HOVER_ACK, &WorldSession::handleAcknowledgementOpcodes, true, true, true, false, false);
800 registry.registerOpcode(MSG_MOVE_START_DESCEND, &WorldSession::handleMovementOpcodes, true, true, true, true, false);
801
802 // Force Speed Change
811
812 // Action Buttons
814 registry.registerOpcode(CMSG_REPOP_REQUEST, &WorldSession::handleRepopRequestOpcode, true, true, true, true, false);
815
816 // Loot
818 registry.registerOpcode(CMSG_LOOT_MONEY, &WorldSession::handleLootMoneyOpcode, true, true, true, true, false);
819 registry.registerOpcode(CMSG_LOOT, &WorldSession::handleLootOpcode, true, true, true, true, false);
820 registry.registerOpcode(CMSG_LOOT_RELEASE, &WorldSession::handleLootReleaseOpcode, true, true, true, true, false);
821 registry.registerOpcode(CMSG_LOOT_ROLL, &WorldSession::handleLootRollOpcode, true, true, true, true, false);
822 registry.registerOpcode(CMSG_LOOT_MASTER_GIVE, &WorldSession::handleLootMasterGiveOpcode, true, true, true, true, false);
823
824 // Player Interaction
825 registry.registerOpcode(CMSG_WHO, &WorldSession::handleWhoOpcode, true, true, true, true, false);
826 registry.registerOpcode(CMSG_WHOIS, &WorldSession::handleWhoIsOpcode, true, false, true, true, false);
827 registry.registerOpcode(CMSG_LOGOUT_REQUEST, &WorldSession::handleLogoutRequestOpcode, true, true, true, true, false);
828 registry.registerOpcode(CMSG_PLAYER_LOGOUT, &WorldSession::handlePlayerLogoutOpcode, true, true, true, false, false);
829 registry.registerOpcode(CMSG_LOGOUT_CANCEL, &WorldSession::handleLogoutCancelOpcode, true, true, true, true, false);
830 // registry.registerOpcode(CMSG_LOGOUT_CANCEL].status = STATUS_LOGGEDIN_RECENTLY_LOGGOUT, false, false, true, false, false);
831
832 registry.registerOpcode(CMSG_ZONEUPDATE, &WorldSession::handleZoneupdate, true, true, true, true, false);
833 // registry.registerOpcode(CMSG_SET_TARGET_OBSOLETE, &WorldSession::HandleSetTargetOpcode, false, false, true, false, false);
834 registry.registerOpcode(CMSG_SET_SELECTION, &WorldSession::handleSetSelectionOpcode, true, true, true, true, false);
836 registry.registerOpcode(CMSG_CANCEL_MOUNT_AURA, &WorldSession::handleDismountOpcode, true, true, true, false, false);
837
838 // Friends
839 registry.registerOpcode(CMSG_CONTACT_LIST, &WorldSession::handleFriendListOpcode, true, true, true, true, false);
840 registry.registerOpcode(CMSG_ADD_FRIEND, &WorldSession::handleAddFriendOpcode, true, true, true, false, false);
841 registry.registerOpcode(CMSG_DEL_FRIEND, &WorldSession::handleDelFriendOpcode, true, true, true, false, false);
842 registry.registerOpcode(CMSG_ADD_IGNORE, &WorldSession::handleAddIgnoreOpcode, true, true, true, false, false);
843 registry.registerOpcode(CMSG_DEL_IGNORE, &WorldSession::handleDelIgnoreOpcode, true, true, true, false, false);
844 registry.registerOpcode(CMSG_BUG, &WorldSession::handleBugOpcode, true, true, true, true, false);
845 registry.registerOpcode(CMSG_SET_CONTACT_NOTES, &WorldSession::handleSetFriendNote, false, true, true, false, false);
846
847 // Areatrigger
848 registry.registerOpcode(CMSG_AREATRIGGER, &WorldSession::handleAreaTriggerOpcode, true, true, true, true, false);
849
850 // Account Data
852 registry.registerOpcode(CMSG_REQUEST_ACCOUNT_DATA, &WorldSession::handleRequestAccountData, true, true, true, false, false);
853 registry.registerOpcode(CMSG_TOGGLE_PVP, &WorldSession::handleTogglePVPOpcode, true, true, true, true, false);
854
855 // Faction / Reputation
856 registry.registerOpcode(CMSG_SET_FACTION_ATWAR, &WorldSession::handleSetFactionAtWarOpcode, true, true, true, false, false);
859
860 // Player Interaction
861 registry.registerOpcode(CMSG_GAMEOBJ_USE, &WorldSession::handleGameObjectUse, true, true, true, true, false);
862 registry.registerOpcode(CMSG_REQUEST_PLAYED_TIME, &WorldSession::handlePlayedTimeOpcode, true, true, true, true, false);
863 registry.registerOpcode(CMSG_SETSHEATHED, &WorldSession::handleSetSheathedOpcode, true, true, true, true, false);
864 registry.registerOpcode(CMSG_MESSAGECHAT, &WorldSession::handleMessageChatOpcode, false, true, true, false, false);
865 registry.registerOpcode(CMSG_EMOTE, &WorldSession::handleEmoteOpcode, true, true, true, true, false);
866 registry.registerOpcode(CMSG_TEXT_EMOTE, &WorldSession::handleTextEmoteOpcode, true, true, true, true, false);
867 registry.registerOpcode(CMSG_INSPECT, &WorldSession::handleInspectOpcode, true, true, true, true, false);
868 // clearly wrong naming!
869 //registry.registerOpcode(SMSG_BARBER_SHOP_RESULT, &WorldSession::handleBarberShopResult, false, false, true, false, false);
870
871 // Channels
872 registry.registerOpcode(CMSG_JOIN_CHANNEL, &WorldSession::handleChannelJoin, false, true, true, true, false);
873 registry.registerOpcode(CMSG_LEAVE_CHANNEL, &WorldSession::handleChannelLeave, true, true, true, true, false);
874 registry.registerOpcode(CMSG_CHANNEL_LIST, &WorldSession::handleChannelList, true, true, true, true, false);
875 registry.registerOpcode(CMSG_CHANNEL_PASSWORD, &WorldSession::handleChannelPassword, true, true, true, true, false);
876 registry.registerOpcode(CMSG_CHANNEL_SET_OWNER, &WorldSession::handleChannelSetOwner, true, true, true, true, false);
877 registry.registerOpcode(CMSG_CHANNEL_OWNER, &WorldSession::handleChannelOwner, true, true, true, true, false);
878 registry.registerOpcode(CMSG_CHANNEL_MODERATOR, &WorldSession::handleChannelModerator, true, true, true, true, false);
879 registry.registerOpcode(CMSG_CHANNEL_UNMODERATOR, &WorldSession::handleChannelUnmoderator, true, true, true, true, false);
880 registry.registerOpcode(CMSG_CHANNEL_MUTE, &WorldSession::handleChannelMute, true, true, true, true, false);
881 registry.registerOpcode(CMSG_CHANNEL_UNMUTE, &WorldSession::handleChannelUnmute, true, true, true, true, false);
882 registry.registerOpcode(CMSG_CHANNEL_INVITE, &WorldSession::handleChannelInvite, true, true, true, true, false);
883 registry.registerOpcode(CMSG_CHANNEL_KICK, &WorldSession::handleChannelKick, true, true, true, true, false);
884 registry.registerOpcode(CMSG_CHANNEL_BAN, &WorldSession::handleChannelBan, true, true, true, true, false);
885 registry.registerOpcode(CMSG_CHANNEL_UNBAN, &WorldSession::handleChannelUnban, true, true, true, true, false);
886 registry.registerOpcode(CMSG_CHANNEL_ANNOUNCEMENTS, &WorldSession::handleChannelAnnounce, true, true, true, true, false);
887 registry.registerOpcode(CMSG_CHANNEL_MODERATE, &WorldSession::handleChannelModerate, true, true, true, true, false);
890
891 // Groups / Raids
892 registry.registerOpcode(CMSG_GROUP_INVITE, &WorldSession::handleGroupInviteOpcode, true, true, true, true, false);
893 //registry.registerOpcode(CMSG_GROUP_CANCEL, &WorldSession::HandleGroupCancelOpcode, false, false, true, false, false);
894 registry.registerOpcode(CMSG_GROUP_ACCEPT, &WorldSession::handleGroupAcceptOpcode, true, true, true, false, false);
895 registry.registerOpcode(CMSG_GROUP_DECLINE, &WorldSession::handleGroupDeclineOpcode, true, true, true, false, false);
896 registry.registerOpcode(CMSG_GROUP_UNINVITE, &WorldSession::handleGroupUninviteOpcode, true, true, true, false, false);
898 registry.registerOpcode(CMSG_GROUP_SET_LEADER, &WorldSession::handleGroupSetLeaderOpcode, true, true, true, true, false);
899 registry.registerOpcode(CMSG_GROUP_DISBAND, &WorldSession::handleGroupDisbandOpcode, true, true, true, true, false);
900 registry.registerOpcode(CMSG_LOOT_METHOD, &WorldSession::handleLootMethodOpcode, true, true, true, true, false);
901 registry.registerOpcode(MSG_MINIMAP_PING, &WorldSession::handleMinimapPingOpcode, true, true, true, false, false);
906 registry.registerOpcode(MSG_RAID_READY_CHECK, &WorldSession::handleReadyCheckOpcode, true, false, true, true, false);
907 registry.registerOpcode(MSG_RAID_TARGET_UPDATE, &WorldSession::handleSetPlayerIconOpcode, true, true, true, false, false);
909 registry.registerOpcode(MSG_PARTY_ASSIGNMENT, &WorldSession::handleGroupPromote, true, true, true, false, false);
910
911 // LFG System
912 registry.registerOpcode(CMSG_SET_LFG_COMMENT, &WorldSession::handleLfgSetCommentOpcode, true, true, true, false, false);
913 registry.registerOpcode(CMSG_LFG_JOIN, &WorldSession::handleLfgJoinOpcode, false, false, true, false, false);
914 registry.registerOpcode(CMSG_LFG_LEAVE, &WorldSession::handleLfgLeaveOpcode, false, false, true, false, false);
915 registry.registerOpcode(CMSG_SEARCH_LFG_JOIN, &WorldSession::handleLfgSearchOpcode, false, false, true, false, false);
916 registry.registerOpcode(CMSG_SEARCH_LFG_LEAVE, &WorldSession::handleLfgSearchLeaveOpcode, false, false, true, false, false);
917 registry.registerOpcode(CMSG_LFG_PROPOSAL_RESULT, &WorldSession::handleLfgProposalResultOpcode, false, false, true, false, false);
918 registry.registerOpcode(CMSG_LFG_SET_ROLES, &WorldSession::handleLfgSetRolesOpcode, false, false, true, false, false);
919 registry.registerOpcode(CMSG_LFG_SET_BOOT_VOTE, &WorldSession::handleLfgSetBootVoteOpcode, false, false, true, false, false);
921 registry.registerOpcode(CMSG_LFG_TELEPORT, &WorldSession::handleLfgTeleportOpcode, false, false, true, false, false);
923
924 // Taxi / NPC Interaction
925 registry.registerOpcode(CMSG_ENABLETAXI, &WorldSession::handleEnabletaxiOpcode, false, true, true, true, false);
928 registry.registerOpcode(CMSG_ACTIVATE_TAXI, &WorldSession::handleActivateTaxiOpcode, true, true, true, true, false);
930 registry.registerOpcode(CMSG_BANKER_ACTIVATE, &WorldSession::handleBankerActivateOpcode, true, true, true, true, false);
931 registry.registerOpcode(CMSG_BUY_BANK_SLOT, &WorldSession::handleBuyBankSlotOpcode, true, true, true, true, false);
932 registry.registerOpcode(CMSG_TRAINER_LIST, &WorldSession::handleTrainerListOpcode, true, true, true, true, false);
935 registry.registerOpcode(MSG_AUCTION_HELLO, &WorldSession::handleAuctionHelloOpcode, true, true, true, true, false);
936 registry.registerOpcode(CMSG_GOSSIP_HELLO, &WorldSession::handleGossipHelloOpcode, true, true, true, true, false);
939 registry.registerOpcode(CMSG_NPC_TEXT_QUERY, &WorldSession::handleNpcTextQueryOpcode, true, true, true, true, false);
940 registry.registerOpcode(CMSG_BINDER_ACTIVATE, &WorldSession::handleBinderActivateOpcode, true, true, true, true, false);
942 registry.registerOpcode(CMSG_MOVE_SPLINE_DONE, &WorldSession::handleMoveSplineDoneOpcode, true, true, true, true, false);
943 // Item / Vendors
944 registry.registerOpcode(CMSG_SWAP_INV_ITEM, &WorldSession::handleSwapInvItemOpcode, true, true, true, true, false);
945 registry.registerOpcode(CMSG_SWAP_ITEM, &WorldSession::handleSwapItemOpcode, true, true, true, true, false);
946 registry.registerOpcode(CMSG_DESTROY_ITEM, &WorldSession::handleDestroyItemOpcode, true, true, true, true, false);
947 registry.registerOpcode(CMSG_AUTOEQUIP_ITEM, &WorldSession::handleAutoEquipItemOpcode, true, true, true, true, false);
949 registry.registerOpcode(CMSG_ITEM_QUERY_SINGLE, &WorldSession::handleItemQuerySingleOpcode, true, true, true, false, false);
950 registry.registerOpcode(CMSG_SELL_ITEM, &WorldSession::handleSellItemOpcode, true, true, true, true, false);
951 registry.registerOpcode(CMSG_BUY_ITEM_IN_SLOT, &WorldSession::handleBuyItemInSlotOpcode, true, true, true, true, false);
952 registry.registerOpcode(CMSG_BUY_ITEM, &WorldSession::handleBuyItemOpcode, true, true, true, true, false);
953 registry.registerOpcode(CMSG_LIST_INVENTORY, &WorldSession::handleListInventoryOpcode, true, true, true, true, false);
955 registry.registerOpcode(CMSG_SET_AMMO, &WorldSession::handleAmmoSetOpcode, true, true, true, false, false);
956 registry.registerOpcode(CMSG_BUY_BACK_ITEM, &WorldSession::handleBuyBackOpcode, true, true, true, true, false);
957 registry.registerOpcode(CMSG_SPLIT_ITEM, &WorldSession::handleSplitOpcode, true, true, true, true, false);
958 registry.registerOpcode(CMSG_READ_ITEM, &WorldSession::handleReadItemOpcode, true, true, true, false, false);
959 registry.registerOpcode(CMSG_REPAIR_ITEM, &WorldSession::handleRepairItemOpcode, true, true, true, true, false);
960 registry.registerOpcode(CMSG_AUTOBANK_ITEM, &WorldSession::handleAutoBankItemOpcode, true, true, true, true, false);
963 registry.registerOpcode(CMSG_SOCKET_GEMS, &WorldSession::handleInsertGemOpcode, false, true, true, true, false);
964 registry.registerOpcode(CMSG_WRAP_ITEM, &WorldSession::handleWrapItemOpcode, true, true, true, false, false);
965 registry.registerOpcode(CMSG_ITEMREFUNDINFO, &WorldSession::handleItemRefundInfoOpcode, false, false, true, true, false);
966 registry.registerOpcode(CMSG_ITEMREFUNDREQUEST, &WorldSession::handleItemRefundRequestOpcode, false, false, true, false, false);
967
968 registry.registerOpcode(CMSG_EQUIPMENT_SET_SAVE, &WorldSession::handleEquipmentSetSave, false, false, true, false, false);
969 registry.registerOpcode(CMSG_EQUIPMENT_SET_USE, &WorldSession::handleEquipmentSetUse, false, false, true, false, false);
970 registry.registerOpcode(CMSG_EQUIPMENT_SET_DELETE, &WorldSession::handleEquipmentSetDelete, false, false, true, false, false);
971
972 // Spell System / Talent System
973 registry.registerOpcode(CMSG_USE_ITEM, &WorldSession::handleUseItemOpcode, true, true, true, true, false);
974 registry.registerOpcode(CMSG_CAST_SPELL, &WorldSession::handleCastSpellOpcode, true, true, true, true, false);
975 registry.registerOpcode(CMSG_SPELL_CLICK, &WorldSession::handleSpellClick, true, false, true, true, false);
976 registry.registerOpcode(CMSG_CANCEL_CAST, &WorldSession::handleCancelCastOpcode, true, true, true, true, false);
977 registry.registerOpcode(CMSG_CANCEL_AURA, &WorldSession::handleCancelAuraOpcode, true, true, true, true, false);
980 registry.registerOpcode(CMSG_TOTEM_DESTROYED, &WorldSession::handleCancelTotem, true, true, true, true, false);
981 registry.registerOpcode(CMSG_LEARN_TALENT, &WorldSession::handleLearnTalentOpcode, true, true, true, true, false);
983 registry.registerOpcode(CMSG_UNLEARN_TALENTS, &WorldSession::handleUnlearnTalents, true, false, true, false, false);
984 registry.registerOpcode(MSG_TALENT_WIPE_CONFIRM, &WorldSession::handleUnlearnTalents, true, false, true, true, false);
986 // Combat / Duel
987 registry.registerOpcode(CMSG_ATTACKSWING, &WorldSession::handleAttackSwingOpcode, true, true, true, true, false);
988 registry.registerOpcode(CMSG_ATTACK_STOP, &WorldSession::handleAttackStopOpcode, true, true, true, true, false);
989 registry.registerOpcode(CMSG_DUEL_ACCEPTED, &WorldSession::handleDuelAccepted, true, true, true, true, false);
990 registry.registerOpcode(CMSG_DUEL_CANCELLED, &WorldSession::handleDuelCancelled, true, true, true, true, false);
991
992 // Trade
993 registry.registerOpcode(CMSG_INITIATE_TRADE, &WorldSession::handleInitiateTradeOpcode, true, true, true, true, false);
994 registry.registerOpcode(CMSG_BEGIN_TRADE, &WorldSession::handleBeginTradeOpcode, true, true, true, true, false);
995 registry.registerOpcode(CMSG_BUSY_TRADE, &WorldSession::handleBusyTrade, true, true, true, false, false);
996 registry.registerOpcode(CMSG_IGNORE_TRADE, &WorldSession::handleIgnoreTrade, true, true, true, false, false);
997 registry.registerOpcode(CMSG_ACCEPT_TRADE, &WorldSession::handleAcceptTrade, true, true, true, true, false);
998 registry.registerOpcode(CMSG_UNACCEPT_TRADE, &WorldSession::handleUnacceptTrade, true, true, true, false, false);
999 registry.registerOpcode(CMSG_CANCEL_TRADE, &WorldSession::handleCancelTrade, true, true, true, true, false);
1000 registry.registerOpcode(CMSG_SET_TRADE_ITEM, &WorldSession::handleSetTradeItem, true, true, true, true, false);
1001 registry.registerOpcode(CMSG_CLEAR_TRADE_ITEM, &WorldSession::handleClearTradeItem, true, true, true, true, false);
1002 registry.registerOpcode(CMSG_SET_TRADE_GOLD, &WorldSession::handleSetTradeGold, true, true, true, true, false);
1003
1004 // Quest System
1007 registry.registerOpcode(CMSG_QUESTGIVER_HELLO, &WorldSession::handleQuestgiverHelloOpcode, true, true, true, true, false);
1009 registry.registerOpcode(CMSG_QUESTGIVER_CANCEL, &WorldSession::handleQuestgiverCancelOpcode, true, true, true, true, false);
1012 registry.registerOpcode(CMSG_QUEST_QUERY, &WorldSession::handleQuestQueryOpcode, true, true, true, true, false);
1016 registry.registerOpcode(CMSG_RECLAIM_CORPSE, &WorldSession::handleCorpseReclaimOpcode, true, true, true, true, false);
1017 registry.registerOpcode(CMSG_RESURRECT_RESPONSE, &WorldSession::handleResurrectResponse, true, true, true, false, false);
1018 registry.registerOpcode(CMSG_PUSHQUESTTOPARTY, &WorldSession::handlePushQuestToPartyOpcode, true, true, true, true, false);
1019 registry.registerOpcode(MSG_QUEST_PUSH_RESULT, &WorldSession::handleQuestPushResultOpcode, true, true, true, false, false);
1020 registry.registerOpcode(CMSG_QUEST_POI_QUERY, &WorldSession::handleQuestPOIQueryOpcode, false, false, true, true, false);
1021
1022 // Auction System
1023 registry.registerOpcode(CMSG_AUCTION_LIST_ITEMS, &WorldSession::handleAuctionListItems, true, true, true, true, false);
1025 registry.registerOpcode(CMSG_AUCTION_SELL_ITEM, &WorldSession::handleAuctionSellItem, true, true, true, true, false);
1027 registry.registerOpcode(CMSG_AUCTION_PLACE_BID, &WorldSession::handleAuctionPlaceBid, true, true, true, true, false);
1028 registry.registerOpcode(CMSG_AUCTION_REMOVE_ITEM, &WorldSession::handleCancelAuction, true, true, true, true, false);
1030
1031 // Mail System
1032 registry.registerOpcode(CMSG_GET_MAIL_LIST, &WorldSession::handleGetMailOpcode, true, true, true, true, false);
1033 registry.registerOpcode(CMSG_ITEM_TEXT_QUERY, &WorldSession::handleItemTextQueryOpcode, true, true, true, true, false);
1034 registry.registerOpcode(CMSG_SEND_MAIL, &WorldSession::handleSendMailOpcode, true, true, true, true, false);
1035 registry.registerOpcode(CMSG_MAIL_TAKE_MONEY, &WorldSession::handleTakeMoneyOpcode, true, true, true, true, false);
1036 registry.registerOpcode(CMSG_MAIL_TAKE_ITEM, &WorldSession::handleTakeItemOpcode, true, true, true, true, false);
1037 registry.registerOpcode(CMSG_MAIL_MARK_AS_READ, &WorldSession::handleMarkAsReadOpcode, true, true, true, true, false);
1039 registry.registerOpcode(CMSG_MAIL_DELETE, &WorldSession::handleMailDeleteOpcode, true, true, true, true, false);
1040 registry.registerOpcode(MSG_QUERY_NEXT_MAIL_TIME, &WorldSession::handleMailTimeOpcode, true, true, true, true, false);
1042
1043 // Guild Query (called when not logged in sometimes)
1044 registry.registerOpcode<STATUS_AUTHED>(CMSG_GUILD_QUERY, &WorldSession::handleGuildQuery, true, true, true, true, false);
1045
1046 // Guild System
1047 //registry.registerOpcode(CMSG_GUILD_CREATE, &WorldSession::HandleCreateGuild, false, false, true, false, false);
1048 registry.registerOpcode(CMSG_GUILD_INVITE, &WorldSession::handleInviteToGuild, true, true, true, true, false);
1049 registry.registerOpcode(CMSG_GUILD_ACCEPT, &WorldSession::handleGuildAccept, true, true, true, true, false);
1050 registry.registerOpcode(CMSG_GUILD_DECLINE, &WorldSession::handleGuildDecline, true, true, true, true, false);
1051 registry.registerOpcode(CMSG_GUILD_INFO, &WorldSession::handleGuildInfo, true, true, true, false, false);
1052 registry.registerOpcode(CMSG_GUILD_ROSTER, &WorldSession::handleGuildRoster, true, true, true, true, false);
1053 registry.registerOpcode(CMSG_GUILD_PROMOTE, &WorldSession::handleGuildPromote, true, true, true, true, false);
1054 registry.registerOpcode(CMSG_GUILD_DEMOTE, &WorldSession::handleGuildDemote, true, true, true, true, false);
1055 registry.registerOpcode(CMSG_GUILD_LEAVE, &WorldSession::handleGuildLeave, true, true, true, true, false);
1056 registry.registerOpcode(CMSG_GUILD_REMOVE, &WorldSession::handleGuildRemove, true, true, true, true, false);
1057 registry.registerOpcode(CMSG_GUILD_DISBAND, &WorldSession::handleGuildDisband, true, true, true, true, false);
1058 registry.registerOpcode(CMSG_GUILD_LEADER, &WorldSession::handleGuildLeader, true, true, true, true, false);
1059 registry.registerOpcode(CMSG_GUILD_MOTD, &WorldSession::handleGuildMotd, true, true, true, true, false);
1060 registry.registerOpcode(CMSG_GUILD_SET_RANK, &WorldSession::handleGuildSetRank, true, false, true, true, false);
1061 registry.registerOpcode(CMSG_GUILD_ADD_RANK, &WorldSession::handleGuildAddRank, true, true, true, true, false);
1062 registry.registerOpcode(CMSG_GUILD_DEL_RANK, &WorldSession::handleGuildDelRank, true, true, true, true, false);
1063 registry.registerOpcode(CMSG_GUILD_SET_PUBLIC_NOTE, &WorldSession::handleGuildSetPublicNote, true, true, true, false, false);
1065 registry.registerOpcode(CMSG_PETITION_BUY, &WorldSession::handleCharterBuy, true, true, true, true, false);
1067 registry.registerOpcode(CMSG_TURN_IN_PETITION, &WorldSession::handleCharterTurnInCharter, true, true, true, true, false);
1068 registry.registerOpcode(CMSG_PETITION_QUERY, &WorldSession::handleCharterQuery, true, true, true, true, false);
1069 registry.registerOpcode(CMSG_OFFER_PETITION, &WorldSession::handleCharterOffer, true, true, true, true, false);
1070 registry.registerOpcode(CMSG_PETITION_SIGN, &WorldSession::handleCharterSign, true, true, true, true, false);
1071 registry.registerOpcode(MSG_PETITION_DECLINE, &WorldSession::handleCharterDecline, true, true, true, true, false);
1072 registry.registerOpcode(MSG_PETITION_RENAME, &WorldSession::handleCharterRename, true, true, true, true, false);
1073 registry.registerOpcode(MSG_SAVE_GUILD_EMBLEM, &WorldSession::handleSaveGuildEmblem, true, true, true, true, false);
1074 registry.registerOpcode(CMSG_GUILD_INFO_TEXT, &WorldSession::handleSetGuildInfo, true, true, true, true, false);
1075 registry.registerOpcode(MSG_QUERY_GUILD_BANK_TEXT, &WorldSession::handleGuildBankQueryText, true, true, true, false, false);
1076 registry.registerOpcode(CMSG_SET_GUILD_BANK_TEXT, &WorldSession::handleSetGuildBankText, true, true, true, true, false);
1077 registry.registerOpcode(MSG_GUILD_EVENT_LOG_QUERY, &WorldSession::handleGuildLog, true, true, true, false, false);
1079 registry.registerOpcode(CMSG_GUILD_BANK_BUY_TAB, &WorldSession::handleGuildBankBuyTab, true, true, true, true, false);
1081 registry.registerOpcode(CMSG_GUILD_BANK_UPDATE_TAB, &WorldSession::handleGuildBankUpdateTab, true, true, true, true, false);
1082 registry.registerOpcode(CMSG_GUILD_BANK_SWAP_ITEMS, &WorldSession::handleGuildBankSwapItems, true, true, true, true, false);
1085 registry.registerOpcode(CMSG_GUILD_BANK_QUERY_TAB, &WorldSession::handleGuildBankQueryTab, true, true, true, true, false);
1086 registry.registerOpcode(MSG_GUILD_BANK_LOG_QUERY, &WorldSession::handleGuildBankLogQuery, true, true, true, true, false);
1087 registry.registerOpcode(MSG_GUILD_PERMISSIONS, &WorldSession::handleGuildPermissions, true, true, true, false, false);
1088
1089 // Tutorials
1090 registry.registerOpcode(CMSG_TUTORIAL_FLAG, &WorldSession::handleTutorialFlag, true, true, true, true, false);
1091 registry.registerOpcode(CMSG_TUTORIAL_CLEAR, &WorldSession::handleTutorialClear, true, true, true, true, false);
1092 registry.registerOpcode(CMSG_TUTORIAL_RESET, &WorldSession::handleTutorialReset, true, true, true, true, false);
1093
1094 // Pets
1095 registry.registerOpcode(MSG_LIST_STABLED_PETS, &WorldSession::handleStabledPetList, true, true, true, false, false);
1096
1097 registry.registerOpcode(CMSG_PET_ACTION, &WorldSession::handlePetAction, true, true, true, true, false);
1098 registry.registerOpcode(CMSG_PET_NAME_QUERY, &WorldSession::handlePetNameQuery, true, true, true, true, false);
1099 registry.registerOpcode(CMSG_BUY_STABLE_SLOT, &WorldSession::handleBuyStableSlot, true, true, true, false, false);
1100 registry.registerOpcode(CMSG_STABLE_PET, &WorldSession::handleStablePet, true, true, true, false, false);
1101 registry.registerOpcode(CMSG_UNSTABLE_PET, &WorldSession::handleUnstablePet, true, true, true, false, false);
1102 registry.registerOpcode(CMSG_STABLE_SWAP_PET, &WorldSession::handleStableSwapPet, true, true, true, false, false);
1103 registry.registerOpcode(CMSG_PET_SET_ACTION, &WorldSession::handlePetSetActionOpcode, true, true, true, false, false);
1104 registry.registerOpcode(CMSG_PET_RENAME, &WorldSession::handlePetRename, true, true, true, false, false);
1105 registry.registerOpcode(CMSG_PET_ABANDON, &WorldSession::handlePetAbandon, true, true, true, false, false);
1106 registry.registerOpcode(CMSG_PET_UNLEARN, &WorldSession::handlePetUnlearn, true, true, true, false, false);
1107 registry.registerOpcode(CMSG_PET_SPELL_AUTOCAST, &WorldSession::handlePetSpellAutocast, true, true, true, true, false);
1108 registry.registerOpcode(CMSG_PET_CANCEL_AURA, &WorldSession::handlePetCancelAura, true, true, true, false, false);
1109 registry.registerOpcode(CMSG_PET_LEARN_TALENT, &WorldSession::handlePetLearnTalent, false, false, true, true, false);
1110 registry.registerOpcode(CMSG_DISMISS_CRITTER, &WorldSession::handleDismissCritter, false, false, true, false, false);
1111
1112 // Battlegrounds
1113 registry.registerOpcode(CMSG_BATTLEFIELD_PORT, &WorldSession::handleBattlefieldPortOpcode, true, true, true, false, false);
1117 registry.registerOpcode(CMSG_BATTLEMASTER_JOIN_ARENA, &WorldSession::handleArenaJoinOpcode, true, true, true, false, false);
1118 registry.registerOpcode(CMSG_BATTLEMASTER_JOIN, &WorldSession::handleBattleMasterJoinOpcode, true, true, true, true, false);
1119 registry.registerOpcode(CMSG_LEAVE_BATTLEFIELD, &WorldSession::handleLeaveBattlefieldOpcode, true, true, true, false, false);
1123 registry.registerOpcode(MSG_PVP_LOG_DATA, &WorldSession::handlePVPLogDataOpcode, true, true, true, false, false);
1126 //registry.registerOpcode(CMSG_BATTLEFIELD_MGR_ENTRY_INVITE_RESPONSE, &WorldSession::HandleBgInviteResponse, false, false, true, false, false);
1127
1128 // GM Ticket System
1129 registry.registerOpcode(CMSG_GMTICKET_CREATE, &WorldSession::handleGMTicketCreateOpcode, false, true, true, true, false);
1130 registry.registerOpcode(CMSG_GMTICKET_UPDATETEXT, &WorldSession::handleGMTicketUpdateOpcode, false, true, true, true, false);
1135
1136 // Lag report
1137 registry.registerOpcode(CMSG_GM_REPORT_LAG, &WorldSession::handleReportLag, false, false, true, false, false);
1138 registry.registerOpcode(CMSG_GMSURVEY_SUBMIT, &WorldSession::handleGMSurveySubmitOpcode, false, false, true, false, false);
1139
1140 // Meeting Stone / Instances
1141 registry.registerOpcode(CMSG_SUMMON_RESPONSE, &WorldSession::handleSummonResponseOpcode, true, true, true, false, false);
1142 registry.registerOpcode(CMSG_RESET_INSTANCES, &WorldSession::handleResetInstanceOpcode, true, true, true, true, false);
1143 registry.registerOpcode(CMSG_SELF_RES, &WorldSession::handleSelfResurrect, true, true, true, false, false);
1144 registry.registerOpcode(MSG_RANDOM_ROLL, &WorldSession::handleRandomRollOpcode, true, true, true, false, false);
1146 registry.registerOpcode(MSG_SET_RAID_DIFFICULTY, &WorldSession::handleRaidDifficultyOpcode, false, false, true, true, false);
1147 registry.registerOpcode(CMSG_INSTANCE_LOCK_RESPONSE, &WorldSession::handleInstanceLockResponse, false, false, true, false, false);
1148 registry.registerOpcode(CMSG_VIOLENCE_LEVEL, &WorldSession::handleViolenceLevel, false, false, false, true, false);
1149
1150 // Misc
1151 registry.registerOpcode(CMSG_OPEN_ITEM, &WorldSession::handleOpenItemOpcode, true, true, true, true, false);
1152 registry.registerOpcode(CMSG_COMPLETE_CINEMATIC, &WorldSession::handleCompleteCinematic, true, true, true, true, false);
1153 registry.registerOpcode(CMSG_NEXT_CINEMATIC_CAMERA, &WorldSession::handleNextCinematic, true, false, true, true, false);
1154 registry.registerOpcode(CMSG_MOUNTSPECIAL_ANIM, &WorldSession::handleMountSpecialAnimOpcode, true, true, true, false, false);
1155 registry.registerOpcode(CMSG_TOGGLE_CLOAK, &WorldSession::handleToggleCloakOpcode, true, true, true, false, false);
1156 registry.registerOpcode(CMSG_TOGGLE_HELM, &WorldSession::handleToggleHelmOpcode, true, true, true, false, false);
1157 registry.registerOpcode(CMSG_SET_TITLE, &WorldSession::handleSetTitle, true, true, true, false, false);
1158 registry.registerOpcode(CMSG_COMPLAIN, &WorldSession::handleReportSpamOpcode, true, false, true, false, false);
1159 registry.registerOpcode(CMSG_GAMEOBJ_REPORT_USE, &WorldSession::handleGameobjReportUseOpCode, false, false, true, true, false);
1160 registry.registerOpcode(CMSG_PET_CAST_SPELL, &WorldSession::handlePetCastSpell, true, true, true, true, false);
1163 registry.registerOpcode(CMSG_UNLEARN_SKILL, &WorldSession::handleUnlearnSkillOpcode, true, true, true, true, false);
1164
1165 // Chat
1166 registry.registerOpcode(CMSG_CHAT_IGNORED, &WorldSession::handleChatIgnoredOpcode, true, false, true, true, false);
1167 registry.registerOpcode(CMSG_SET_CHANNEL_WATCH, &WorldSession::handleChatChannelWatchOpcode, true, false, true, true, false);
1168
1169 // Arenas
1170 registry.registerOpcode(CMSG_ARENA_TEAM_QUERY, &WorldSession::handleArenaTeamQueryOpcode, false, true, true, false, false);
1171 registry.registerOpcode(CMSG_ARENA_TEAM_ROSTER, &WorldSession::handleArenaTeamRosterOpcode, false, true, true, false, false);
1172 registry.registerOpcode(CMSG_ARENA_TEAM_INVITE, &WorldSession::handleArenaTeamAddMemberOpcode, false, true, true, false, false);
1175 registry.registerOpcode(CMSG_ARENA_TEAM_LEAVE, &WorldSession::handleArenaTeamLeaveOpcode, false, true, true, false, false);
1177 registry.registerOpcode(CMSG_ARENA_TEAM_DISBAND, &WorldSession::handleArenaTeamDisbandOpcode, false, true, true, false, false);
1178 registry.registerOpcode(CMSG_ARENA_TEAM_LEADER, &WorldSession::handleArenaTeamPromoteOpcode, false, true, true, false, false);
1179 registry.registerOpcode(MSG_INSPECT_ARENA_TEAMS, &WorldSession::handleInspectArenaStatsOpcode, false, true, true, false, false);
1180
1181 // cheat/gm commands?
1182 registry.registerOpcode(CMSG_WORLD_TELEPORT, &WorldSession::handleWorldTeleportOpcode, true, true, true, false, false);
1183
1184 // Vehicle
1185 registry.registerOpcode(CMSG_DISMISS_CONTROLLED_VEHICLE, &WorldSession::handleDismissVehicle, false, false, true, true, false);
1186 registry.registerOpcode(CMSG_REQUEST_VEHICLE_EXIT, &WorldSession::handleLeaveVehicle, false, false, true, true, false);
1191 registry.registerOpcode(CMSG_PLAYER_VEHICLE_ENTER, &WorldSession::handleEnterVehicle, false, false, true, true, false);
1192 registry.registerOpcode(CMSG_EJECT_PASSENGER, &WorldSession::handleRemoveVehiclePassenger, false, false, true, true, false);
1193
1194 // Unsorted
1196
1197 registry.registerOpcode(CMSG_OPT_OUT_OF_LOOT, &WorldSession::handleSetAutoLootPassOpcode, true, true, true, false, false);
1198 registry.registerOpcode(CMSG_REMOVE_GLYPH, &WorldSession::handleRemoveGlyph, false, false, true, false, false);
1199 registry.registerOpcode(CMSG_ALTER_APPEARANCE, &WorldSession::handleBarberShopResult, false, false, true, true, false);
1200 registry.registerOpcode(CMSG_GET_MIRRORIMAGE_DATA, &WorldSession::HandleMirrorImageOpcode, true, false, true, false, false);
1201
1202 // Calendar - Unhandled
1203 registry.registerOpcode(CMSG_CALENDAR_GET_CALENDAR, &WorldSession::handleCalendarGetCalendar, false, false, true, true, false);
1204 registry.registerOpcode(CMSG_CALENDAR_COMPLAIN, &WorldSession::handleCalendarComplain, false, false, true, false, false);
1206 registry.registerOpcode(CMSG_CALENDAR_ADD_EVENT, &WorldSession::handleCalendarAddEvent, false, false, true, false, false);
1207
1208 registry.registerOpcode(CMSG_CALENDAR_GET_EVENT, &WorldSession::handleCalendarGetEvent, false, false, true, false, false);
1209 registry.registerOpcode(CMSG_CALENDAR_GUILD_FILTER, &WorldSession::handleCalendarGuildFilter, false, false, true, false, false);
1210 registry.registerOpcode(CMSG_CALENDAR_ARENA_TEAM, &WorldSession::handleCalendarArenaTeam, false, false, true, false, false);
1211 registry.registerOpcode(CMSG_CALENDAR_UPDATE_EVENT, &WorldSession::handleCalendarUpdateEvent, false, false, true, false, false);
1212 registry.registerOpcode(CMSG_CALENDAR_REMOVE_EVENT, &WorldSession::handleCalendarRemoveEvent, false, false, true, false, false);
1213 registry.registerOpcode(CMSG_CALENDAR_COPY_EVENT, &WorldSession::handleCalendarCopyEvent, false, false, true, false, false);
1214 registry.registerOpcode(CMSG_CALENDAR_EVENT_INVITE, &WorldSession::handleCalendarEventInvite, false, false, true, false, false);
1215 registry.registerOpcode(CMSG_CALENDAR_EVENT_RSVP, &WorldSession::handleCalendarEventRsvp, false, false, true, false, false);
1217 registry.registerOpcode(CMSG_CALENDAR_EVENT_STATUS, &WorldSession::handleCalendarEventStatus, false, false, true, false, false);
1219
1220 //Misc - Unhandled
1221 registry.registerOpcode(CMSG_FAR_SIGHT, &WorldSession::Unhandled, false, false, true, true, false);
1222 registry.registerOpcode(CMSG_LFG_GET_STATUS, &WorldSession::Unhandled, false, false, true, true, false);
1223 registry.registerOpcode(CMSG_VOICE_SESSION_ENABLE, &WorldSession::Unhandled, true, false, true, true, false);
1224 registry.registerOpcode(CMSG_SET_ACTIVE_VOICE_CHANNEL, &WorldSession::Unhandled, true, false, true, false, false);
1225
1226 // new since cata
1230 registry.registerOpcode(CMSG_MOVE_SET_CAN_FLY, &WorldSession::handleMovementOpcodes, false, false, false, true, false);
1232 registry.registerOpcode(CMSG_MESSAGECHAT_SAY, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1233 registry.registerOpcode(CMSG_MESSAGECHAT_YELL, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1234 registry.registerOpcode(CMSG_MESSAGECHAT_CHANNEL, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1235 registry.registerOpcode(CMSG_MESSAGECHAT_WHISPER, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1236 registry.registerOpcode(CMSG_MESSAGECHAT_GUILD, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1237 registry.registerOpcode(CMSG_MESSAGECHAT_OFFICER, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1238 registry.registerOpcode(CMSG_MESSAGECHAT_AFK, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1239 registry.registerOpcode(CMSG_MESSAGECHAT_DND, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1240 registry.registerOpcode(CMSG_MESSAGECHAT_EMOTE, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1241 registry.registerOpcode(CMSG_MESSAGECHAT_PARTY, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1242 registry.registerOpcode(CMSG_MESSAGECHAT_RAID, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1243 registry.registerOpcode(CMSG_MESSAGECHAT_RAID_WARNING, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1244 registry.registerOpcode(CMSG_MESSAGECHAT_BATTLEGROUND, &WorldSession::handleMessageChatOpcode, false, false, false, true, false);
1246 registry.registerOpcode(CMSG_GROUP_SET_ROLES, &WorldSession::handleGroupSetRolesOpcode, false, false, false, true, false);
1248 registry.registerOpcode(CMSG_ROLE_CHECK_BEGIN, &WorldSession::handleGroupRoleCheckBeginOpcode, false, false, false, true, false);
1249 registry.registerOpcode(CMSG_MAKE_EVERYONE_ASSISTANT, &WorldSession::nothingToHandle, false, false, false, true, false);
1250 registry.registerOpcode(MSG_RAID_READY_CHECK_FINISHED, &WorldSession::nothingToHandle, false, false, false, true, false);
1251 registry.registerOpcode(CMSG_LFG_LOCK_INFO_REQUEST, &WorldSession::handleLfgLockInfoOpcode, false, false, false, true, false);
1252 registry.registerOpcode(CMSG_TRANSMOGRIFY_ITEMS, &WorldSession::handleTransmogrifyItems, false, false, false, true, false);
1253 registry.registerOpcode(CMSG_REFORGE_ITEM, &WorldSession::handleReforgeItemOpcode, false, false, false, true, false);
1254 registry.registerOpcode(CMSG_VOID_STORAGE_QUERY, &WorldSession::handleVoidStorageQuery, false, false, false, true, false);
1255 registry.registerOpcode(CMSG_VOID_STORAGE_TRANSFER, &WorldSession::handleVoidStorageTransfer, false, false, false, true, false);
1256 registry.registerOpcode(CMSG_VOID_STORAGE_UNLOCK, &WorldSession::handleVoidStorageUnlock, false, false, false, true, false);
1257 registry.registerOpcode(CMSG_VOID_SWAP_ITEM, &WorldSession::handleVoidSwapItem, false, false, false, true, false);
1260 registry.registerOpcode(CMSG_GUILD_BANK_QUERY_TEXT, &WorldSession::handleQueryGuildBankTabText, false, false, false, true, false);
1261 registry.registerOpcode(CMSG_QUERY_GUILD_XP, &WorldSession::handleGuildQueryXPOpcode, false, false, false, true, false);
1262 registry.registerOpcode(CMSG_GUILD_SET_NOTE, &WorldSession::handleGuildSetNoteOpcode, false, false, false, true, false);
1263 registry.registerOpcode(CMSG_QUERY_GUILD_REWARDS, &WorldSession::handleGuildRewardsQueryOpcode, false, false, false, true, false);
1264 registry.registerOpcode(CMSG_GUILD_QUERY_RANKS, &WorldSession::handleGuildQueryRanksOpcode, false, false, false, true, false);
1266 registry.registerOpcode(CMSG_GUILD_EVENT_LOG_QUERY, &WorldSession::handleGuildLog, false, false, false, true, false);
1269 registry.registerOpcode(CMSG_GUILD_QUERY_NEWS, &WorldSession::handleGuildQueryNewsOpcode, false, false, false, true, false);
1271 registry.registerOpcode(CMSG_GUILD_PERMISSIONS, &WorldSession::handleGuildPermissions, false, false, false, true, false);
1272 registry.registerOpcode(CMSG_LF_GUILD_GET_RECRUITS, &WorldSession::handleGuildFinderGetRecruits, false, false, false, true, false);
1273 registry.registerOpcode(CMSG_LF_GUILD_ADD_RECRUIT, &WorldSession::handleGuildFinderAddRecruit, false, false, false, true, false);
1274 registry.registerOpcode(CMSG_LF_GUILD_BROWSE, &WorldSession::handleGuildFinderBrowse, false, false, false, true, false);
1277 registry.registerOpcode(CMSG_LF_GUILD_POST_REQUEST, &WorldSession::handleGuildFinderPostRequest, false, false, false, true, false);
1282 registry.registerOpcode(CMSG_REQUEST_PVP_REWARDS, &WorldSession::handleRequestPvPRewardsOpcode, false, false, false, true, false);
1285 registry.registerOpcode(CMSG_REPORT, &WorldSession::handleReportOpcode, false, false, false, true, false);
1286 registry.registerOpcode(CMSG_REPORT_PLAYER, &WorldSession::handleReportPlayerOpcode, false, false, false, true, false);
1288 registry.registerOpcode(CMSG_REQUEST_HOTFIX, &WorldSession::handleRequestHotfix, false, false, false, true, false);
1289 registry.registerOpcode(CMSG_RETURN_TO_GRAVEYARD, &WorldSession::handleReturnToGraveyardOpcode, false, false, false, true, false);
1290 registry.registerOpcode(CMSG_SUGGESTION_SUBMIT, &WorldSession::handleSuggestionOpcode, false, false, false, true, false);
1291 registry.registerOpcode(CMSG_LOG_DISCONNECT, &WorldSession::handleLogDisconnectOpcode, false, false, false, true, false);
1292 registry.registerOpcode(CMSG_PET_LEVEL_CHEAT, &WorldSession::Unhandled, false, false, false, true, false);
1293 registry.registerOpcode(CMSG_QUERY_BATTLEFIELD_STATE, &WorldSession::Unhandled, false, false, false, true, false);
1296}
@ CMSG_QUESTGIVER_HELLO
Definition Opcodes.hpp:433
@ CMSG_GUILD_INFO
Definition Opcodes.hpp:171
@ CMSG_LFG_JOIN
Definition Opcodes.hpp:1166
@ CMSG_TIME_SYNC_RESPONSE
Definition Opcodes.hpp:995
@ CMSG_PET_CAST_SPELL
Definition Opcodes.hpp:550
@ CMSG_BUY_ITEM_IN_SLOT
Definition Opcodes.hpp:464
@ CMSG_QUERY_GUILD_REWARDS
Definition Opcodes.hpp:1529
@ CMSG_CALENDAR_EVENT_MODERATOR_STATUS
Definition Opcodes.hpp:1209
@ CMSG_LEARN_PREVIEW_TALENTS
Definition Opcodes.hpp:1485
@ CMSG_TURN_IN_PETITION
Definition Opcodes.hpp:502
@ CMSG_CALENDAR_ADD_EVENT
Definition Opcodes.hpp:1201
@ CMSG_ACCEPT_TRADE
Definition Opcodes.hpp:326
@ MSG_RANDOM_ROLL
Definition Opcodes.hpp:562
@ CMSG_AUCTION_SELL_ITEM
Definition Opcodes.hpp:660
@ CMSG_ATTACK_STOP
Definition Opcodes.hpp:367
@ CMSG_ATTACKSWING
Definition Opcodes.hpp:366
@ CMSG_CALENDAR_EVENT_REMOVE_INVITE
Definition Opcodes.hpp:1207
@ MSG_PETITION_DECLINE
Definition Opcodes.hpp:499
@ CMSG_GUILD_SET_NOTE
Definition Opcodes.hpp:1481
@ CMSG_SUGGESTION_SUBMIT
Definition Opcodes.hpp:1561
@ CMSG_COMPLAIN
Definition Opcodes.hpp:1048
@ MSG_MOVE_SET_FACING
Definition Opcodes.hpp:262
@ CMSG_GUILD_DEL_RANK
Definition Opcodes.hpp:623
@ CMSG_SEARCH_LFG_JOIN
Definition Opcodes.hpp:1168
@ CMSG_ADDON_REGISTERED_PREFIXES
Definition Opcodes.hpp:1444
@ CMSG_ENUM_CHARACTERS
Definition Opcodes.hpp:91
@ CMSG_PET_LEARN_TALENT
Definition Opcodes.hpp:1278
@ CMSG_FAR_SIGHT
Definition Opcodes.hpp:697
@ MSG_MOVE_START_BACKWARD
Definition Opcodes.hpp:219
@ CMSG_EJECT_PASSENGER
Definition Opcodes.hpp:1325
@ CMSG_LOGOUT_REQUEST
Definition Opcodes.hpp:111
@ CMSG_SET_WATCHED_FACTION
Definition Opcodes.hpp:862
@ CMSG_PET_RENAME
Definition Opcodes.hpp:420
@ CMSG_GROUP_REQUEST_JOIN_UPDATES
Definition Opcodes.hpp:1463
@ CMSG_LFD_PARTY_LOCK_INFO_REQUEST
Definition Opcodes.hpp:1186
@ CMSG_UNREGISTER_ALL_ADDON_PREFIXES
Definition Opcodes.hpp:1569
@ CMSG_QUEST_QUERY
Definition Opcodes.hpp:128
@ CMSG_SET_GUILD_BANK_TEXT
Definition Opcodes.hpp:1122
@ CMSG_MESSAGECHAT_YELL
Definition Opcodes.hpp:1520
@ CMSG_MESSAGECHAT_CHANNEL
Definition Opcodes.hpp:1510
@ CMSG_REPAIR_ITEM
Definition Opcodes.hpp:743
@ CMSG_ARENA_TEAM_DISBAND
Definition Opcodes.hpp:934
@ CMSG_QUERY_GUILD_XP
Definition Opcodes.hpp:1530
@ MSG_GUILD_PERMISSIONS
Definition Opcodes.hpp:1104
@ MSG_RAID_READY_CHECK
Definition Opcodes.hpp:876
@ CMSG_LEARN_TALENT
Definition Opcodes.hpp:653
@ CMSG_TEXT_EMOTE
Definition Opcodes.hpp:304
@ CMSG_REQUEST_VEHICLE_SWITCH_SEAT
Definition Opcodes.hpp:1277
@ CMSG_CHANNEL_BAN
Definition Opcodes.hpp:202
@ CMSG_SEND_MAIL
Definition Opcodes.hpp:628
@ CMSG_CHANNEL_KICK
Definition Opcodes.hpp:201
@ CMSG_GUILD_ROSTER
Definition Opcodes.hpp:173
@ CMSG_LOOT
Definition Opcodes.hpp:394
@ CMSG_PET_ACTION
Definition Opcodes.hpp:418
@ CMSG_SEARCH_LFG_LEAVE
Definition Opcodes.hpp:1169
@ CMSG_GUILD_BANK_QUERY_TEXT
Definition Opcodes.hpp:1470
@ CMSG_QUESTGIVER_STATUS_QUERY
Definition Opcodes.hpp:431
@ CMSG_REPOP_REQUEST
Definition Opcodes.hpp:391
@ CMSG_UNACCEPT_TRADE
Definition Opcodes.hpp:327
@ MSG_MOVE_STOP_PITCH
Definition Opcodes.hpp:230
@ CMSG_TOTEM_DESTROYED
Definition Opcodes.hpp:1131
@ CMSG_PETITION_QUERY
Definition Opcodes.hpp:504
@ MSG_MOVE_SET_RUN_MODE
Definition Opcodes.hpp:231
@ CMSG_PET_ABANDON
Definition Opcodes.hpp:419
@ CMSG_BUY_ITEM
Definition Opcodes.hpp:463
@ CMSG_CANCEL_AURA
Definition Opcodes.hpp:354
@ MSG_MOVE_START_TURN_RIGHT
Definition Opcodes.hpp:226
@ CMSG_GUILD_SET_RANK
Definition Opcodes.hpp:621
@ CMSG_QUESTGIVER_COMPLETE_QUEST
Definition Opcodes.hpp:439
@ CMSG_CHANNEL_PASSWORD
Definition Opcodes.hpp:193
@ CMSG_CHANNEL_SET_OWNER
Definition Opcodes.hpp:194
@ CMSG_LOADING_SCREEN_NOTIFY
Definition Opcodes.hpp:1498
@ CMSG_LOOT_RELEASE
Definition Opcodes.hpp:396
@ CMSG_AUTOSTORE_BAG_ITEM
Definition Opcodes.hpp:311
@ CMSG_GMTICKET_CREATE
Definition Opcodes.hpp:574
@ CMSG_TOGGLE_PVP
Definition Opcodes.hpp:655
@ CMSG_GUILD_REQUEST_MAX_DAILY_XP
Definition Opcodes.hpp:1478
@ CMSG_CALENDAR_EVENT_INVITE
Definition Opcodes.hpp:1205
@ CMSG_GUILD_ACCEPT
Definition Opcodes.hpp:168
@ CMSG_SET_FACTION_INACTIVE
Definition Opcodes.hpp:861
@ CMSG_LIST_INVENTORY
Definition Opcodes.hpp:459
@ CMSG_RECLAIM_CORPSE
Definition Opcodes.hpp:516
@ CMSG_BATTLEFIELD_STATUS
Definition Opcodes.hpp:789
@ CMSG_GUILD_BANK_DEPOSIT_MONEY
Definition Opcodes.hpp:1085
@ CMSG_MOUNTSPECIAL_ANIM
Definition Opcodes.hpp:414
@ CMSG_GUILD_LEAVE
Definition Opcodes.hpp:178
@ CMSG_CREATURE_QUERY
Definition Opcodes.hpp:132
@ CMSG_LFG_TELEPORT
Definition Opcodes.hpp:1185
@ CMSG_MOVE_SET_CAN_FLY_ACK
Definition Opcodes.hpp:918
@ CMSG_CALENDAR_GET_EVENT
Definition Opcodes.hpp:1198
@ CMSG_LEAVE_CHANNEL
Definition Opcodes.hpp:189
@ CMSG_CALENDAR_EVENT_STATUS
Definition Opcodes.hpp:1208
@ CMSG_TRANSMOGRIFY_ITEMS
Definition Opcodes.hpp:477
@ MSG_RAID_READY_CHECK_FINISHED
Definition Opcodes.hpp:1047
@ CMSG_GUILD_BANK_WITHDRAW_MONEY
Definition Opcodes.hpp:1086
@ MSG_MOVE_STOP_ASCEND
Definition Opcodes.hpp:939
@ CMSG_SET_CONTACT_NOTES
Definition Opcodes.hpp:143
@ CMSG_TUTORIAL_FLAG
Definition Opcodes.hpp:298
@ CMSG_CHANNEL_UNMUTE
Definition Opcodes.hpp:199
@ CMSG_REQUEST_RATED_BG_STATS
Definition Opcodes.hpp:1544
@ CMSG_BUY_BACK_ITEM
Definition Opcodes.hpp:719
@ CMSG_SET_TRADE_GOLD
Definition Opcodes.hpp:331
@ MSG_MOVE_SET_PITCH
Definition Opcodes.hpp:263
@ CMSG_PETITION_SHOWLIST
Definition Opcodes.hpp:492
@ CMSG_BATTLEMASTER_JOIN
Definition Opcodes.hpp:820
@ CMSG_ARENA_TEAM_ROSTER
Definition Opcodes.hpp:926
@ CMSG_AUCTION_LIST_ITEMS
Definition Opcodes.hpp:662
@ CMSG_GROUP_SET_ROLES
Definition Opcodes.hpp:1464
@ CMSG_CHANNEL_OWNER
Definition Opcodes.hpp:195
@ CMSG_ENABLETAXI
Definition Opcodes.hpp:1303
@ CMSG_USE_ITEM
Definition Opcodes.hpp:208
@ CMSG_QUEST_POI_QUERY
Definition Opcodes.hpp:1157
@ CMSG_GM_REPORT_LAG
Definition Opcodes.hpp:1415
@ CMSG_MESSAGECHAT_RAID_WARNING
Definition Opcodes.hpp:1517
@ CMSG_OPEN_ITEM
Definition Opcodes.hpp:209
@ CMSG_ZONEUPDATE
Definition Opcodes.hpp:555
@ MSG_MOVE_START_TURN_LEFT
Definition Opcodes.hpp:225
@ CMSG_READ_ITEM
Definition Opcodes.hpp:210
@ CMSG_SOCKET_GEMS
Definition Opcodes.hpp:920
@ CMSG_SET_LFG_COMMENT
Definition Opcodes.hpp:951
@ MSG_MOVE_START_SWIM
Definition Opcodes.hpp:240
@ CMSG_SET_TITLE
Definition Opcodes.hpp:965
@ CMSG_GUILD_DEMOTE
Definition Opcodes.hpp:177
@ CMSG_JOIN_CHANNEL
Definition Opcodes.hpp:188
@ CMSG_LFG_LEAVE
Definition Opcodes.hpp:1167
@ MSG_QUERY_GUILD_BANK_TEXT
Definition Opcodes.hpp:1121
@ CMSG_GET_MIRRORIMAGE_DATA
Definition Opcodes.hpp:1112
@ CMSG_LF_GUILD_ADD_RECRUIT
Definition Opcodes.hpp:1486
@ CMSG_AUTOSTORE_LOOT_ITEM
Definition Opcodes.hpp:308
@ MSG_BATTLEGROUND_PLAYER_POSITIONS
Definition Opcodes.hpp:815
@ MSG_MOVE_STOP_STRAFE
Definition Opcodes.hpp:223
@ CMSG_GAMEOBJ_REPORT_USE
Definition Opcodes.hpp:1285
@ MSG_PVP_LOG_DATA
Definition Opcodes.hpp:804
@ CMSG_CHANNEL_MUTE
Definition Opcodes.hpp:198
@ CMSG_CHANNEL_UNBAN
Definition Opcodes.hpp:203
@ CMSG_MAIL_TAKE_MONEY
Definition Opcodes.hpp:641
@ MSG_SAVE_GUILD_EMBLEM
Definition Opcodes.hpp:551
@ CMSG_COMPLETE_CINEMATIC
Definition Opcodes.hpp:296
@ CMSG_CALENDAR_GET_NUM_PENDING
Definition Opcodes.hpp:1227
@ CMSG_SELF_RES
Definition Opcodes.hpp:756
@ CMSG_ACTIVATE_TAXI
Definition Opcodes.hpp:474
@ CMSG_REQUEST_VEHICLE_NEXT_SEAT
Definition Opcodes.hpp:1276
@ CMSG_TOGGLE_CLOAK
Definition Opcodes.hpp:763
@ CMSG_ARENA_TEAM_REMOVE
Definition Opcodes.hpp:933
@ CMSG_GROUP_ASSISTANT_LEADER
Definition Opcodes.hpp:718
@ CMSG_TUTORIAL_RESET
Definition Opcodes.hpp:300
@ CMSG_QUESTGIVER_ACCEPT_QUEST
Definition Opcodes.hpp:438
@ CMSG_CANCEL_CAST
Definition Opcodes.hpp:347
@ CMSG_GOSSIP_SELECT_OPTION
Definition Opcodes.hpp:425
@ CMSG_GMTICKET_SYSTEMSTATUS
Definition Opcodes.hpp:598
@ CMSG_REQUEST_VEHICLE_PREV_SEAT
Definition Opcodes.hpp:1275
@ CMSG_GUILD_QUERY_RANKS
Definition Opcodes.hpp:1475
@ CMSG_AUTOEQUIP_ITEM_SLOT
Definition Opcodes.hpp:315
@ CMSG_CHANNEL_LIST
Definition Opcodes.hpp:191
@ CMSG_REQUEST_VEHICLE_EXIT
Definition Opcodes.hpp:1274
@ CMSG_GUILD_INVITE
Definition Opcodes.hpp:166
@ CMSG_UPDATE_PROJECTILE_POSITION
Definition Opcodes.hpp:1346
@ CMSG_EMOTE
Definition Opcodes.hpp:302
@ CMSG_WORLD_STATE_UI_TIMER_UPDATE
Definition Opcodes.hpp:1403
@ MSG_MOVE_STOP_TURN
Definition Opcodes.hpp:227
@ CMSG_ROLE_CHECK_BEGIN
Definition Opcodes.hpp:1547
@ CMSG_GUILD_DECLINE
Definition Opcodes.hpp:169
@ CMSG_MESSAGECHAT_DND
Definition Opcodes.hpp:1511
@ MSG_TALENT_WIPE_CONFIRM
Definition Opcodes.hpp:745
@ CMSG_GROUP_INVITE
Definition Opcodes.hpp:146
@ CMSG_MAIL_CREATE_TEXT_ITEM
Definition Opcodes.hpp:646
@ CMSG_NAME_QUERY
Definition Opcodes.hpp:116
@ CMSG_ITEM_TEXT_QUERY
Definition Opcodes.hpp:639
@ CMSG_ARENA_TEAM_LEADER
Definition Opcodes.hpp:935
@ CMSG_GROUP_UNINVITE
Definition Opcodes.hpp:153
@ CMSG_CANCEL_TRADE
Definition Opcodes.hpp:328
@ CMSG_SET_ACTIVE_VOICE_CHANNEL
Definition Opcodes.hpp:1060
@ CMSG_PET_LEVEL_CHEAT
Definition Opcodes.hpp:74
@ CMSG_PET_SET_ACTION
Definition Opcodes.hpp:417
@ MSG_SET_RAID_DIFFICULTY
Definition Opcodes.hpp:1390
@ CMSG_SET_FACTION_ATWAR
Definition Opcodes.hpp:337
@ CMSG_CLEAR_TRADE_ITEM
Definition Opcodes.hpp:330
@ CMSG_SET_ACTIONBAR_TOGGLES
Definition Opcodes.hpp:768
@ CMSG_UNLEARN_TALENTS
Definition Opcodes.hpp:589
@ CMSG_BUY_STABLE_SLOT
Definition Opcodes.hpp:688
@ CMSG_OPT_OUT_OF_LOOT
Definition Opcodes.hpp:1120
@ CMSG_DEL_IGNORE
Definition Opcodes.hpp:145
@ CMSG_RETURN_TO_GRAVEYARD
Definition Opcodes.hpp:1546
@ CMSG_LFG_GET_STATUS
Definition Opcodes.hpp:1163
@ CMSG_AREA_SPIRIT_HEALER_QUEUE
Definition Opcodes.hpp:809
@ CMSG_EQUIPMENT_SET_SAVE
Definition Opcodes.hpp:1345
@ CMSG_MOVE_SET_CAN_FLY
Definition Opcodes.hpp:1521
@ CMSG_CALENDAR_COMPLAIN
Definition Opcodes.hpp:1226
@ CMSG_GUILD_SET_OFFICER_NOTE
Definition Opcodes.hpp:625
@ CMSG_STABLE_SWAP_PET
Definition Opcodes.hpp:691
@ CMSG_MOVE_FEATHER_FALL_ACK
Definition Opcodes.hpp:785
@ CMSG_OFFER_PETITION
Definition Opcodes.hpp:501
@ CMSG_MOVE_WATER_WALK_ACK
Definition Opcodes.hpp:786
@ CMSG_VOID_SWAP_ITEM
Definition Opcodes.hpp:1575
@ CMSG_TRAINER_LIST
Definition Opcodes.hpp:478
@ MSG_MOVE_START_STRAFE_RIGHT
Definition Opcodes.hpp:222
@ CMSG_GMTICKET_GETTICKET
Definition Opcodes.hpp:587
@ CMSG_GUILD_PERMISSIONS
Definition Opcodes.hpp:1105
@ CMSG_AUTOSTORE_BANK_ITEM
Definition Opcodes.hpp:705
@ CMSG_STANDSTATECHANGE
Definition Opcodes.hpp:301
@ CMSG_MAKE_EVERYONE_ASSISTANT
Definition Opcodes.hpp:1501
@ CMSG_GROUP_CHANGE_SUB_GROUP
Definition Opcodes.hpp:701
@ MSG_GUILD_BANK_LOG_QUERY
Definition Opcodes.hpp:1087
@ CMSG_GUILD_ADD_RANK
Definition Opcodes.hpp:622
@ CMSG_DISMISS_CRITTER
Definition Opcodes.hpp:1297
@ CMSG_CHANNEL_MODERATE
Definition Opcodes.hpp:205
@ CMSG_LFG_SET_BOOT_VOTE
Definition Opcodes.hpp:1181
@ CMSG_UNSTABLE_PET
Definition Opcodes.hpp:687
@ MSG_QUEST_PUSH_RESULT
Definition Opcodes.hpp:692
@ CMSG_CALENDAR_GET_CALENDAR
Definition Opcodes.hpp:1197
@ CMSG_UPDATE_ACCOUNT_DATA
Definition Opcodes.hpp:581
@ CMSG_CHAR_DELETE
Definition Opcodes.hpp:92
@ CMSG_MOVE_HOVER_ACK
Definition Opcodes.hpp:290
@ CMSG_AUCTION_REMOVE_ITEM
Definition Opcodes.hpp:661
@ CMSG_BUSY_TRADE
Definition Opcodes.hpp:324
@ CMSG_SET_PLAYER_DECLINED_NAMES
Definition Opcodes.hpp:1136
@ CMSG_WHOIS
Definition Opcodes.hpp:136
@ MSG_MINIMAP_PING
Definition Opcodes.hpp:519
@ CMSG_PET_NAME_QUERY
Definition Opcodes.hpp:118
@ MSG_RAID_TARGET_UPDATE
Definition Opcodes.hpp:872
@ CMSG_GOSSIP_HELLO
Definition Opcodes.hpp:424
@ CMSG_MAIL_MARK_AS_READ
Definition Opcodes.hpp:643
@ CMSG_LFD_PLAYER_LOCK_INFO_REQUEST
Definition Opcodes.hpp:1183
@ CMSG_SPLIT_ITEM
Definition Opcodes.hpp:314
@ CMSG_AUTOBANK_ITEM
Definition Opcodes.hpp:706
@ CMSG_BINDER_ACTIVATE
Definition Opcodes.hpp:483
@ CMSG_GROUP_SET_LEADER
Definition Opcodes.hpp:156
@ MSG_MOVE_START_PITCH_DOWN
Definition Opcodes.hpp:229
@ CMSG_REPORT_PLAYER
Definition Opcodes.hpp:1536
@ CMSG_AUCTION_PLACE_BID
Definition Opcodes.hpp:664
@ CMSG_ARENA_TEAM_ACCEPT
Definition Opcodes.hpp:930
@ CMSG_CHAR_CUSTOMIZE
Definition Opcodes.hpp:1271
@ CMSG_PET_SPELL_AUTOCAST
Definition Opcodes.hpp:825
@ MSG_LIST_STABLED_PETS
Definition Opcodes.hpp:685
@ CMSG_CANCEL_TEMP_ENCHANTMENT
Definition Opcodes.hpp:970
@ CMSG_BUG
Definition Opcodes.hpp:508
@ CMSG_MOVE_NOT_ACTIVE_MOVER
Definition Opcodes.hpp:787
@ CMSG_MESSAGECHAT_SAY
Definition Opcodes.hpp:1518
@ CMSG_MESSAGECHAT_RAID
Definition Opcodes.hpp:1516
@ CMSG_SET_TAXI_BENCHMARK_MODE
Definition Opcodes.hpp:987
@ CMSG_BATTLEFIELD_LIST
Definition Opcodes.hpp:632
@ CMSG_BANKER_ACTIVATE
Definition Opcodes.hpp:488
@ CMSG_REQUEST_PVP_REWARDS
Definition Opcodes.hpp:1542
@ CMSG_CALENDAR_COPY_EVENT
Definition Opcodes.hpp:1204
@ CMSG_GUILD_REMOVE
Definition Opcodes.hpp:179
@ CMSG_LF_GUILD_DECLINE_RECRUIT
Definition Opcodes.hpp:1488
@ CMSG_GUILD_DISBAND
Definition Opcodes.hpp:180
@ CMSG_SUMMON_RESPONSE
Definition Opcodes.hpp:747
@ CMSG_AREATRIGGER
Definition Opcodes.hpp:217
@ CMSG_REQUEST_PLAYED_TIME
Definition Opcodes.hpp:510
@ CMSG_ITEM_NAME_QUERY
Definition Opcodes.hpp:775
@ CMSG_REQUEST_PVP_OPTIONS_ENABLED
Definition Opcodes.hpp:1541
@ CMSG_ADD_IGNORE
Definition Opcodes.hpp:144
@ CMSG_GMTICKET_UPDATETEXT
Definition Opcodes.hpp:576
@ CMSG_QUERY_INSPECT_ACHIEVEMENTS
Definition Opcodes.hpp:1263
@ CMSG_CONTACT_LIST
Definition Opcodes.hpp:138
@ CMSG_MESSAGECHAT_WHISPER
Definition Opcodes.hpp:1519
@ CMSG_WORLD_TELEPORT
Definition Opcodes.hpp:44
@ CMSG_SET_CHANNEL_WATCH
Definition Opcodes.hpp:1090
@ CMSG_CHAR_RENAME
Definition Opcodes.hpp:778
@ CMSG_GUILD_BANKER_ACTIVATE
Definition Opcodes.hpp:1079
@ CMSG_CALENDAR_EVENT_RSVP
Definition Opcodes.hpp:1206
@ CMSG_LOOT_MONEY
Definition Opcodes.hpp:395
@ CMSG_TAXINODE_STATUS_QUERY
Definition Opcodes.hpp:471
@ CMSG_LF_GUILD_SET_GUILD_POST
Definition Opcodes.hpp:1493
@ CMSG_AUCTION_LIST_BIDDER_ITEMS
Definition Opcodes.hpp:674
@ MSG_PARTY_ASSIGNMENT
Definition Opcodes.hpp:992
@ CMSG_ARENA_TEAM_INVITE
Definition Opcodes.hpp:928
@ CMSG_GMSURVEY_SUBMIT
Definition Opcodes.hpp:891
@ CMSG_SET_AMMO
Definition Opcodes.hpp:678
@ CMSG_GROUP_DISBAND
Definition Opcodes.hpp:159
@ CMSG_MESSAGECHAT_OFFICER
Definition Opcodes.hpp:1514
@ CMSG_ALTER_APPEARANCE
Definition Opcodes.hpp:1194
@ MSG_MOVE_HEARTBEAT
Definition Opcodes.hpp:283
@ CMSG_GMTICKET_DELETETICKET
Definition Opcodes.hpp:595
@ CMSG_PETITION_SHOW_SIGNATURES
Definition Opcodes.hpp:495
@ CMSG_TUTORIAL_CLEAR
Definition Opcodes.hpp:299
@ CMSG_CHANNEL_DISPLAY_LIST
Definition Opcodes.hpp:1059
@ CMSG_NEXT_CINEMATIC_CAMERA
Definition Opcodes.hpp:295
@ CMSG_MOVE_SPLINE_DONE
Definition Opcodes.hpp:780
@ CMSG_MOVE_CHNG_TRANSPORT
Definition Opcodes.hpp:991
@ CMSG_MOVE_KNOCK_BACK_ACK
Definition Opcodes.hpp:284
@ CMSG_SET_ACTION_BUTTON
Definition Opcodes.hpp:340
@ CMSG_WRAP_ITEM
Definition Opcodes.hpp:517
@ CMSG_LOOT_ROLL
Definition Opcodes.hpp:735
@ CMSG_GAMEOBJECT_QUERY
Definition Opcodes.hpp:130
@ CMSG_SPIRIT_HEALER_ACTIVATE
Definition Opcodes.hpp:600
@ CMSG_SET_TRADE_ITEM
Definition Opcodes.hpp:329
@ CMSG_GUILD_NEWS_UPDATE_STICKY
Definition Opcodes.hpp:1473
@ CMSG_MESSAGECHAT_PARTY
Definition Opcodes.hpp:1515
@ CMSG_LOOT_METHOD
Definition Opcodes.hpp:158
@ CMSG_LF_GUILD_GET_RECRUITS
Definition Opcodes.hpp:1490
@ CMSG_GROUP_ACCEPT
Definition Opcodes.hpp:150
@ CMSG_FORCE_MOVE_ROOT_ACK
Definition Opcodes.hpp:276
@ CMSG_MESSAGECHAT_GUILD
Definition Opcodes.hpp:1513
@ CMSG_BEGIN_TRADE
Definition Opcodes.hpp:323
@ CMSG_GUILD_QUERY
Definition Opcodes.hpp:120
@ CMSG_QUESTGIVER_REQUEST_REWARD
Definition Opcodes.hpp:441
@ CMSG_VOICE_SESSION_ENABLE
Definition Opcodes.hpp:1025
@ CMSG_LEAVE_BATTLEFIELD
Definition Opcodes.hpp:807
@ CMSG_INSPECT
Definition Opcodes.hpp:320
@ MSG_GUILD_BANK_MONEY_WITHDRAWN
Definition Opcodes.hpp:1107
@ CMSG_GROUP_UNINVITE_GUID
Definition Opcodes.hpp:154
@ CMSG_GUILD_ASSIGN_MEMBER_RANK
Definition Opcodes.hpp:1467
@ CMSG_CHANNEL_INVITE
Definition Opcodes.hpp:200
@ CMSG_AREA_SPIRIT_HEALER_QUERY
Definition Opcodes.hpp:808
@ MSG_AUCTION_HELLO
Definition Opcodes.hpp:657
@ CMSG_CALENDAR_ARENA_TEAM
Definition Opcodes.hpp:1200
@ CMSG_DISMISS_CONTROLLED_VEHICLE
Definition Opcodes.hpp:1265
@ CMSG_DEL_FRIEND
Definition Opcodes.hpp:142
@ CMSG_OBJECT_UPDATE_FAILED
Definition Opcodes.hpp:1523
@ CMSG_CANCEL_CHANNELLING
Definition Opcodes.hpp:359
@ MSG_MOVE_TELEPORT_ACK
Definition Opcodes.hpp:236
@ CMSG_GUILD_INFO_TEXT
Definition Opcodes.hpp:834
@ CMSG_TAXIQUERYAVAILABLENODES
Definition Opcodes.hpp:473
@ CMSG_AUCTION_LIST_OWNER_ITEMS
Definition Opcodes.hpp:663
@ CMSG_LF_GUILD_POST_REQUEST
Definition Opcodes.hpp:1491
@ CMSG_LOG_DISCONNECT
Definition Opcodes.hpp:1499
@ CMSG_QUEST_GIVER_STATUS_MULTIPLE_QUERY
Definition Opcodes.hpp:1134
@ CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE
Definition Opcodes.hpp:1311
@ CMSG_GUILD_EVENT_LOG_QUERY
Definition Opcodes.hpp:1109
@ CMSG_IGNORE_TRADE
Definition Opcodes.hpp:325
@ CMSG_STABLE_PET
Definition Opcodes.hpp:686
@ CMSG_MESSAGECHAT
Definition Opcodes.hpp:186
@ CMSG_MAIL_DELETE
Definition Opcodes.hpp:645
@ CMSG_SET_ACTIVE_MOVER
Definition Opcodes.hpp:680
@ MSG_MOVE_WORLDPORT_ACK
Definition Opcodes.hpp:264
@ CMSG_QUERY_TIME
Definition Opcodes.hpp:512
@ CMSG_QUESTLOG_REMOVE_QUEST
Definition Opcodes.hpp:449
@ CMSG_REQUEST_RATED_BG_INFO
Definition Opcodes.hpp:1543
@ CMSG_CHANNEL_ANNOUNCEMENTS
Definition Opcodes.hpp:204
@ MSG_CORPSE_QUERY
Definition Opcodes.hpp:592
@ CMSG_LOOT_MASTER_GIVE
Definition Opcodes.hpp:738
@ CMSG_ADD_FRIEND
Definition Opcodes.hpp:141
@ CMSG_FORCE_MOVE_UNROOT_ACK
Definition Opcodes.hpp:278
@ CMSG_QUESTGIVER_CANCEL
Definition Opcodes.hpp:445
@ CMSG_REQUEST_RAID_INFO
Definition Opcodes.hpp:784
@ CMSG_PAGE_TEXT_QUERY
Definition Opcodes.hpp:126
@ CMSG_LFG_PROPOSAL_RESULT
Definition Opcodes.hpp:1172
@ CMSG_REQUEST_ACCOUNT_DATA
Definition Opcodes.hpp:580
@ CMSG_RESURRECT_RESPONSE
Definition Opcodes.hpp:393
@ CMSG_MESSAGECHAT_EMOTE
Definition Opcodes.hpp:1512
@ CMSG_MESSAGECHAT_BATTLEGROUND
Definition Opcodes.hpp:1509
@ CMSG_LOGOUT_CANCEL
Definition Opcodes.hpp:114
@ CMSG_GROUP_RAID_CONVERT
Definition Opcodes.hpp:717
@ CMSG_CHANNEL_UNMODERATOR
Definition Opcodes.hpp:197
@ CMSG_READY_FOR_ACCOUNT_DATA_TIMES
Definition Opcodes.hpp:1412
@ CMSG_CHAR_CREATE
Definition Opcodes.hpp:90
@ CMSG_PET_UNLEARN
Definition Opcodes.hpp:822
@ CMSG_CANCEL_AUTO_REPEAT_SPELL
Definition Opcodes.hpp:683
@ CMSG_SET_SELECTION
Definition Opcodes.hpp:362
@ CMSG_PUSHQUESTTOPARTY
Definition Opcodes.hpp:458
@ CMSG_TOGGLE_HELM
Definition Opcodes.hpp:762
@ CMSG_BATTLEMASTER_JOIN_ARENA
Definition Opcodes.hpp:937
@ CMSG_WHO
Definition Opcodes.hpp:134
@ CMSG_QUERY_BATTLEFIELD_STATE
Definition Opcodes.hpp:1525
@ MSG_INSPECT_ARENA_TEAMS
Definition Opcodes.hpp:968
@ CMSG_PLAYER_LOGIN
Definition Opcodes.hpp:97
@ CMSG_VOID_STORAGE_UNLOCK
Definition Opcodes.hpp:1574
@ CMSG_MESSAGECHAT_AFK
Definition Opcodes.hpp:1508
@ CMSG_PLAYER_LOGOUT
Definition Opcodes.hpp:110
@ CMSG_NPC_TEXT_QUERY
Definition Opcodes.hpp:428
@ CMSG_CALENDAR_UPDATE_EVENT
Definition Opcodes.hpp:1202
@ CMSG_DESTROY_ITEM
Definition Opcodes.hpp:317
@ CMSG_MAIL_TAKE_ITEM
Definition Opcodes.hpp:642
@ CMSG_GROUP_INVITE_RESPONSE
Definition Opcodes.hpp:1462
@ CMSG_LFG_LOCK_INFO_REQUEST
Definition Opcodes.hpp:1496
@ CMSG_RESET_INSTANCES
Definition Opcodes.hpp:868
@ CMSG_GROUP_DECLINE
Definition Opcodes.hpp:151
@ CMSG_GMTICKETSYSTEM_TOGGLE
Definition Opcodes.hpp:729
@ CMSG_LF_GUILD_REMOVE_RECRUIT
Definition Opcodes.hpp:1492
@ CMSG_VOID_STORAGE_QUERY
Definition Opcodes.hpp:1572
@ MSG_SET_DUNGEON_DIFFICULTY
Definition Opcodes.hpp:888
@ CMSG_BATTLEFIELD_PORT
Definition Opcodes.hpp:791
@ CMSG_MAIL_RETURN_TO_SENDER
Definition Opcodes.hpp:644
@ CMSG_GUILD_SET_PUBLIC_NOTE
Definition Opcodes.hpp:624
@ CMSG_LFG_SET_ROLES
Definition Opcodes.hpp:1179
@ MSG_MOVE_SET_WALK_MODE
Definition Opcodes.hpp:232
@ MSG_MOVE_START_PITCH_UP
Definition Opcodes.hpp:228
@ CMSG_REQUEST_CEMETERY_LIST
Definition Opcodes.hpp:1538
@ CMSG_SETSHEATHED
Definition Opcodes.hpp:533
@ CMSG_SWAP_INV_ITEM
Definition Opcodes.hpp:313
@ CMSG_PET_CANCEL_AURA
Definition Opcodes.hpp:681
@ CMSG_DUEL_CANCELLED
Definition Opcodes.hpp:410
@ CMSG_GUILD_BANK_MONEY_WITHDRAWN_QUERY
Definition Opcodes.hpp:1469
@ MSG_MOVE_START_ASCEND
Definition Opcodes.hpp:938
@ CMSG_GUILD_LEADER
Definition Opcodes.hpp:181
@ CMSG_TRAINER_BUY_SPELL
Definition Opcodes.hpp:480
@ MSG_GUILD_EVENT_LOG_QUERY
Definition Opcodes.hpp:1108
@ CMSG_LF_GUILD_BROWSE
Definition Opcodes.hpp:1487
@ CMSG_SWAP_ITEM
Definition Opcodes.hpp:312
@ MSG_MOVE_START_STRAFE_LEFT
Definition Opcodes.hpp:221
@ CMSG_LEARN_TALENTS_MULTIPLE
Definition Opcodes.hpp:1349
@ CMSG_UNLEARN_SKILL
Definition Opcodes.hpp:571
@ CMSG_INITIATE_TRADE
Definition Opcodes.hpp:322
@ CMSG_DUEL_ACCEPTED
Definition Opcodes.hpp:409
@ CMSG_EQUIPMENT_SET_DELETE
Definition Opcodes.hpp:1153
@ CMSG_ACTIVATE_TAXI_EXPRESS
Definition Opcodes.hpp:856
@ MSG_MOVE_STOP
Definition Opcodes.hpp:220
@ CMSG_INSTANCE_LOCK_RESPONSE
Definition Opcodes.hpp:364
@ CMSG_QUESTGIVER_CHOOSE_REWARD
Definition Opcodes.hpp:443
@ CMSG_GUILD_QUERY_NEWS
Definition Opcodes.hpp:1474
@ CMSG_AUTOEQUIP_ITEM
Definition Opcodes.hpp:310
@ CMSG_ARENA_TEAM_DECLINE
Definition Opcodes.hpp:931
@ CMSG_SPELL_CLICK
Definition Opcodes.hpp:1099
@ CMSG_REPORT
Definition Opcodes.hpp:1535
@ CMSG_GUILD_BANK_SWAP_ITEMS
Definition Opcodes.hpp:1082
@ CMSG_CHAT_IGNORED
Definition Opcodes.hpp:609
@ CMSG_EQUIPMENT_SET_USE
Definition Opcodes.hpp:1368
@ CMSG_REALM_SPLIT
Definition Opcodes.hpp:990
@ CMSG_ITEMREFUNDINFO
Definition Opcodes.hpp:1335
@ CMSG_CALENDAR_REMOVE_EVENT
Definition Opcodes.hpp:1203
@ CMSG_GUILD_REQUEST_CHALLENGE_UPDATE
Definition Opcodes.hpp:1477
@ CMSG_ITEMREFUNDREQUEST
Definition Opcodes.hpp:1336
@ MSG_TABARDVENDOR_ACTIVATE
Definition Opcodes.hpp:552
@ CMSG_GET_MAIL_LIST
Definition Opcodes.hpp:630
@ CMSG_CAST_SPELL
Definition Opcodes.hpp:346
@ CMSG_ARENA_TEAM_QUERY
Definition Opcodes.hpp:924
@ CMSG_REFORGE_ITEM
Definition Opcodes.hpp:1533
@ CMSG_SELL_ITEM
Definition Opcodes.hpp:461
@ CMSG_CHAR_FACTION_CHANGE
Definition Opcodes.hpp:1372
@ CMSG_GUILD_BANK_BUY_TAB
Definition Opcodes.hpp:1083
@ MSG_PETITION_RENAME
Definition Opcodes.hpp:770
@ CMSG_CHANNEL_MODERATOR
Definition Opcodes.hpp:196
@ CMSG_PETITION_BUY
Definition Opcodes.hpp:494
@ CMSG_PETITION_SIGN
Definition Opcodes.hpp:497
@ CMSG_GET_CHANNEL_MEMBER_COUNT
Definition Opcodes.hpp:1061
@ CMSG_CANCEL_MOUNT_AURA
Definition Opcodes.hpp:966
@ CMSG_CALENDAR_GUILD_FILTER
Definition Opcodes.hpp:1199
@ MSG_MOVE_START_DESCEND
Definition Opcodes.hpp:1017
@ CMSG_VIOLENCE_LEVEL
Definition Opcodes.hpp:1571
@ CMSG_ARENA_TEAM_LEAVE
Definition Opcodes.hpp:932
@ CMSG_LF_GUILD_GET_APPLICATIONS
Definition Opcodes.hpp:1489
@ MSG_INSPECT_HONOR_STATS
Definition Opcodes.hpp:792
@ MSG_MOVE_STOP_SWIM
Definition Opcodes.hpp:241
@ CMSG_REMOVE_GLYPH
Definition Opcodes.hpp:1294
@ CMSG_GUILD_BANK_QUERY_TAB
Definition Opcodes.hpp:1080
@ CMSG_PLAYER_VEHICLE_ENTER
Definition Opcodes.hpp:1324
@ CMSG_BATTLEMASTER_HELLO
Definition Opcodes.hpp:795
@ CMSG_BUY_BANK_SLOT
Definition Opcodes.hpp:490
@ CMSG_REQUEST_PARTY_MEMBER_STATS
Definition Opcodes.hpp:702
@ CMSG_AUCTION_LIST_PENDING_SALES
Definition Opcodes.hpp:1299
@ CMSG_GUILD_PROMOTE
Definition Opcodes.hpp:176
@ CMSG_VOID_STORAGE_TRANSFER
Definition Opcodes.hpp:1573
@ CMSG_ITEM_QUERY_SINGLE
Definition Opcodes.hpp:122
@ CMSG_GUILD_BANK_UPDATE_TAB
Definition Opcodes.hpp:1084
@ CMSG_GUILD_MOTD
Definition Opcodes.hpp:182
@ CMSG_MOVE_SET_FLY
Definition Opcodes.hpp:919
@ CMSG_REQUEST_HOTFIX
Definition Opcodes.hpp:1539
@ CMSG_GAMEOBJ_USE
Definition Opcodes.hpp:214
@ SMSG_GMTICKET_GETTICKET
Definition Opcodes.hpp:588
static OpcodeHandlerRegistry & instance()
void registerOpcode(uint32_t opcode, void(WorldSession::*handler)(WorldPacket &), bool classic, bool tbc, bool wotlk, bool cata, bool mop)
void handleGroupInviteResponseOpcode(WorldPacket &recvPacket)
void handleUseItemOpcode(WorldPacket &recvPacket)
void handleGuildRemove(WorldPacket &recvPacket)
void handleRealmSplitOpcode(WorldPacket &recvPacket)
void handleMultipleActivateTaxiOpcode(WorldPacket &recvPacket)
void handleGMTicketUpdateOpcode(WorldPacket &recvPacket)
void handleGuildMotd(WorldPacket &recvPacket)
void handleCharterRename(WorldPacket &recvPacket)
void handleChannelModerate(WorldPacket &recvPacket)
void handleChannelInvite(WorldPacket &recvPacket)
void handleAutoEquipItemOpcode(WorldPacket &recvPacket)
void nothingToHandle(WorldPacket &recvPacket)
void handlePVPLogDataOpcode(WorldPacket &)
void handleArenaTeamAddMemberOpcode(WorldPacket &recvPacket)
void handleBattleMasterJoinOpcode(WorldPacket &recvPacket)
void handleGMTicketGetTicketOpcode(WorldPacket &)
void handleChangeSeatsOnControlledVehicle(WorldPacket &recvPacket)
void handleChannelPassword(WorldPacket &recvPacket)
void handleDestroyItemOpcode(WorldPacket &recvPacket)
void handleGuildPermissions(WorldPacket &)
void handleCalendarComplain(WorldPacket &recvPacket)
void handleReturnToSenderOpcode(WorldPacket &recvPacket)
void handleLootReleaseOpcode(WorldPacket &recvPacket)
void handleGuildAccept(WorldPacket &)
void handleAchievmentQueryOpcode(WorldPacket &recvPacket)
void handleStandStateChangeOpcode(WorldPacket &recvPacket)
void handleSwapInvItemOpcode(WorldPacket &recvPacket)
void handleLfgJoinOpcode(WorldPacket &recvPacket)
void handlePlayedTimeOpcode(WorldPacket &recvPacket)
void handleLogoutCancelOpcode(WorldPacket &)
void handleGroupPromote(WorldPacket &recvPacket)
void handleAuctionPlaceBid(WorldPacket &recvPacket)
void handleTabardVendorActivateOpcode(WorldPacket &recvPacket)
void handleAreaSpiritHealerQueueOpcode(WorldPacket &recvPacket)
void handleBattlegroundPlayerPositionsOpcode(WorldPacket &)
void handleDismissCritter(WorldPacket &recvPacket)
void handleSetSelectionOpcode(WorldPacket &recvPacket)
void handleToggleHelmOpcode(WorldPacket &)
void handlePageTextQueryOpcode(WorldPacket &recvPacket)
void handleSummonResponseOpcode(WorldPacket &recvPacket)
void handleGuildQueryNewsOpcode(WorldPacket &recvPacket)
void handleGuildQueryXPOpcode(WorldPacket &recvPacket)
void handleGuildDisband(WorldPacket &)
void handlePetRename(WorldPacket &recvPacket)
void handleEquipmentSetUse(WorldPacket &recvPacket)
void handleArenaTeamRemoveMemberOpcode(WorldPacket &recvPacket)
void handleSetSheathedOpcode(WorldPacket &recvPacket)
void handleMoveSplineDoneOpcode(WorldPacket &recvPacket)
void handleAttackSwingOpcode(WorldPacket &recvPacket)
void handleCastSpellOpcode(WorldPacket &recvPacket)
void handleRequestCemeteryListOpcode(WorldPacket &)
void handleReturnToGraveyardOpcode(WorldPacket &)
void handleTutorialClear(WorldPacket &)
void handleRequestRatedBgInfoOpcode(WorldPacket &recvPacket)
void handleGetChannelMemberCount(WorldPacket &recvPacket)
void handleCancelChannellingOpcode(WorldPacket &recvPacket)
void handleUnacceptTrade(WorldPacket &)
void handleChannelList(WorldPacket &recvPacket)
void handleBattlefieldListOpcode(WorldPacket &recvPacket)
void handleChatIgnoredOpcode(WorldPacket &recvPacket)
void handleGuildAddRank(WorldPacket &recvPacket)
void handlePetUnlearn(WorldPacket &recvPacket)
void handleSetFactionInactiveOpcode(WorldPacket &recvPacket)
void handleReforgeItemOpcode(WorldPacket &recvData)
void handleArenaTeamInviteAcceptOpcode(WorldPacket &)
void handleQuestgiverRequestRewardOpcode(WorldPacket &recvPacket)
void handleGuildFinderDeclineRecruit(WorldPacket &recvPacket)
void handleChannelOwner(WorldPacket &recvPacket)
void handleChannelUnban(WorldPacket &recvPacket)
void handleMailDeleteOpcode(WorldPacket &recvPacket)
void handleGuildLeave(WorldPacket &)
void handleRequestPvpOptionsOpcode(WorldPacket &)
void handleAddFriendOpcode(WorldPacket &recvPacket)
void handleResurrectResponse(WorldPacket &recvPacket)
void handleCancelCastOpcode(WorldPacket &recvPacket)
void handleLogoutRequestOpcode(WorldPacket &)
void handleQuestPushResultOpcode(WorldPacket &recvPacket)
void handleSetActiveMoverOpcode(WorldPacket &recvPacket)
void handleWorldTeleportOpcode(WorldPacket &recvPacket)
void handleTextEmoteOpcode(WorldPacket &recvPacket)
void handleClearTradeItem(WorldPacket &recvPacket)
void handleMoveTeleportAckOpcode(WorldPacket &recvPacket)
void handleRequestVehiclePreviousSeat(WorldPacket &)
void handleLfgSearchLeaveOpcode(WorldPacket &recvPacket)
void handleGuildFinderAddRecruit(WorldPacket &recvPacket)
void handleAutostoreLootItemOpcode(WorldPacket &recvPacket)
void handleChannelModerator(WorldPacket &recvPacket)
void handleGuildSetRank(WorldPacket &recvPacket)
void handleWhoOpcode(WorldPacket &recvPacket)
void handleEnabletaxiOpcode(WorldPacket &recvPacket)
void handleAuctionListPendingSales(WorldPacket &recvPacket)
void handleRequestVehicleNextSeat(WorldPacket &)
void handleChannelUnmute(WorldPacket &recvPacket)
void handleMinimapPingOpcode(WorldPacket &recvPacket)
void handleGuildInfo(WorldPacket &)
void handleGroupUninviteOpcode(WorldPacket &recvPacket)
void handleGuildBankSwapItems(WorldPacket &recvPacket)
void handleGuildBankerActivate(WorldPacket &recvPacket)
void handleCalendarGuildFilter(WorldPacket &recvPacket)
void handleBattleMasterHelloOpcode(WorldPacket &recvPacket)
void handleEmoteOpcode(WorldPacket &recvPacket)
void handleGroupDisbandOpcode(WorldPacket &)
void handleForceSpeedChangeAck(WorldPacket &recvPacket)
void handleGMTicketCreateOpcode(WorldPacket &recvPacket)
void handlePetSpellAutocast(WorldPacket &recvPacket)
void handleLfgSearchOpcode(WorldPacket &recvPacket)
void handleArenaTeamRosterOpcode(WorldPacket &recvPacket)
void handleVoidSwapItem(WorldPacket &recvData)
void handleLfgPlayerLockInfoRequestOpcode(WorldPacket &recvPacket)
void handleResetInstanceOpcode(WorldPacket &)
void handleChannelRosterQuery(WorldPacket &recvPacket)
void handleTutorialReset(WorldPacket &)
void handleBankerActivateOpcode(WorldPacket &recvPacket)
void handleGuildRequestMaxDailyXP(WorldPacket &recvPacket)
void handleObjectUpdateFailedOpcode(WorldPacket &recvPacket)
void handleNextCinematic(WorldPacket &)
void handleReportOpcode(WorldPacket &recvPacket)
void handleQuestgiverHelloOpcode(WorldPacket &recvPacket)
void handleMarkAsReadOpcode(WorldPacket &recvPacket)
void handleCharCreateOpcode(WorldPacket &recvPacket)
void Unhandled(WorldPacket &recvPacket)
void handleCalendarUpdateEvent(WorldPacket &recvPacket)
void handleBeginTradeOpcode(WorldPacket &)
void handleWhoIsOpcode(WorldPacket &recvPacket)
void handleUnstablePet(WorldPacket &recvPacket)
void handleCalendarEventRsvp(WorldPacket &recvPacket)
void handleQueryTimeOpcode(WorldPacket &recvPacket)
void handleTutorialFlag(WorldPacket &recvPacket)
void handleMountSpecialAnimOpcode(WorldPacket &)
void handleGossipSelectOptionOpcode(WorldPacket &recvPacket)
void handleAutoBankItemOpcode(WorldPacket &recvPacket)
void handleGuildFinderRemoveRecruit(WorldPacket &recvPacket)
void handlePartyMemberStatsOpcode(WorldPacket &recvPacket)
void handlePetAbandon(WorldPacket &)
void handleVoidStorageQuery(WorldPacket &recvData)
void handleCancelTrade(WorldPacket &recvPacket)
void handleAddonRegisteredPrefixesOpcode(WorldPacket &recvPacket)
void handleConvertGroupToRaidOpcode(WorldPacket &)
void handleBuyStableSlot(WorldPacket &)
void handleBarberShopResult(WorldPacket &recvPacket)
void handleAddIgnoreOpcode(WorldPacket &recvPacket)
void handleGMTicketDeleteOpcode(WorldPacket &)
void handleGuildRequestChallengeUpdate(WorldPacket &)
void handleCharterDecline(WorldPacket &recvPacket)
void handleGuildSetOfficerNote(WorldPacket &recvPacket)
void handleCharFactionOrRaceChange(WorldPacket &recvPacket)
void handleCalendarAddEvent(WorldPacket &recvPacket)
void handleArenaTeamLeaveOpcode(WorldPacket &recvPacket)
void handleBuyItemInSlotOpcode(WorldPacket &recvPacket)
void handleDuelAccepted(WorldPacket &)
void handleCorpseReclaimOpcode(WorldPacket &recvPacket)
void handleLearnMultipleTalentsOpcode(WorldPacket &recvPacket)
void handleBugOpcode(WorldPacket &recvPacket)
void handleGuildFinderPostRequest(WorldPacket &)
void handleTogglePVPOpcode(WorldPacket &)
void handleCorpseQueryOpcode(WorldPacket &)
void handleLoadScreenOpcode(WorldPacket &recvPacket)
void handleGuildAssignRankOpcode(WorldPacket &recvPacket)
void handlePetSetActionOpcode(WorldPacket &recvPacket)
void handleDismissVehicle(WorldPacket &)
void handleLearnTalentOpcode(WorldPacket &recvPacket)
void handleCancelTotem(WorldPacket &recvPacket)
void handleSetPlayerIconOpcode(WorldPacket &recvPacket)
void handleUnlearnSkillOpcode(WorldPacket &recvPacket)
void handleMailCreateTextItemOpcode(WorldPacket &recvPacket)
void handleWrapItemOpcode(WorldPacket &recvPacket)
void handleSplitOpcode(WorldPacket &recvPacket)
void handleGuildQuery(WorldPacket &recvPacket)
void handleRandomRollOpcode(WorldPacket &recvPacket)
void handleGroupSetLeaderOpcode(WorldPacket &recvPacket)
void handleDelIgnoreOpcode(WorldPacket &recvPacket)
void handleInsertGemOpcode(WorldPacket &recvPacket)
void handlePlayerLogoutOpcode(WorldPacket &)
void handleSetAutoLootPassOpcode(WorldPacket &recvPacket)
void handleGuildDelRank(WorldPacket &recvPacket)
void handleChannelMute(WorldPacket &recvPacket)
void handleMailTimeOpcode(WorldPacket &)
void handleLfgTeleportOpcode(WorldPacket &recvPacket)
void handleChannelJoin(WorldPacket &recvPacket)
void handleCharterQuery(WorldPacket &recvPacket)
void handleQueryGuildBankTabText(WorldPacket &recvPacket)
void handleGuildRewardsQueryOpcode(WorldPacket &recvPacket)
void handleItemNameQueryOpcode(WorldPacket &recvPacket)
void handleSetGuildInfo(WorldPacket &recvPacket)
void handleSetActionButtonOpcode(WorldPacket &recvPacket)
void handlePetCastSpell(WorldPacket &recvPacket)
void handleLootMethodOpcode(WorldPacket &recvPacket)
void handleDelFriendOpcode(WorldPacket &recvPacket)
void handleSetTitle(WorldPacket &recvPacket)
void handleNameQueryOpcode(WorldPacket &recvPacket)
void handleItemQuerySingleOpcode(WorldPacket &recvPacket)
void handleLootMoneyOpcode(WorldPacket &)
void handleBinderActivateOpcode(WorldPacket &recvPacket)
void handleCalendarCopyEvent(WorldPacket &recvPacket)
void handleCalendarEventRemoveInvite(WorldPacket &recvPacket)
void handleCharCustomizeLooksOpcode(WorldPacket &recvPacket)
void handleLfgLeaveOpcode(WorldPacket &recvPacket)
void handleGMTicketSystemStatusOpcode(WorldPacket &)
void handleDuelCancelled(WorldPacket &)
void handleSetFactionAtWarOpcode(WorldPacket &recvPacket)
void handleLfgPartyLockInfoRequestOpcode(WorldPacket &recvPacket)
void handleAutoStoreBankItemOpcode(WorldPacket &recvPacket)
void handleArenaTeamDisbandOpcode(WorldPacket &recvPacket)
void handleChannelLeave(WorldPacket &recvPacket)
void handleWorldStateUITimerUpdate(WorldPacket &)
void handleItemTextQueryOpcode(WorldPacket &recvPacket)
void handleGuildFinderBrowse(WorldPacket &recvPacket)
void handleCancelAutoRepeatSpellOpcode(WorldPacket &)
void handleInspectArenaStatsOpcode(WorldPacket &recvPacket)
void handleBuyBankSlotOpcode(WorldPacket &recvPacket)
void handleBuyItemOpcode(WorldPacket &recvPacket)
void handleSpellClick(WorldPacket &recvPacket)
void handleLeaveBattlefieldOpcode(WorldPacket &)
void handleTrainerListOpcode(WorldPacket &recvPacket)
void handleCharterBuy(WorldPacket &recvPacket)
void handleTimeSyncRespOpcode(WorldPacket &recvPacket)
void handleTakeItemOpcode(WorldPacket &recvPacket)
void handleRemoveVehiclePassenger(WorldPacket &recvPacket)
void handleZoneupdate(WorldPacket &recvPacket)
void handleSetActionBarTogglesOpcode(WorldPacket &recvPacket)
void handleLfgSetCommentOpcode(WorldPacket &recvPacket)
void handleGroupSetRolesOpcode(WorldPacket &recvPacket)
void handleSwapItemOpcode(WorldPacket &recvPacket)
void handleArenaTeamQueryOpcode(WorldPacket &recvPacket)
void handleQuestgiverCancelOpcode(WorldPacket &recvPacket)
void handleGuildQueryRanksOpcode(WorldPacket &recvPacket)
void handleChatChannelWatchOpcode(WorldPacket &recvPacket)
void handleQuestPOIQueryOpcode(WorldPacket &recvPacket)
void handleLfgSetBootVoteOpcode(WorldPacket &recvPacket)
void handleGuildBankQueryText(WorldPacket &recvPacket)
void handleInviteToGuild(WorldPacket &recvPacket)
void handleGuildBankDepositMoney(WorldPacket &recvPacket)
void handleAreaTriggerOpcode(WorldPacket &recvPacket)
void handleCharterOffer(WorldPacket &recvPacket)
void handleMessageChatOpcode(WorldPacket &recvPacket)
void handleInrangeQuestgiverQuery(WorldPacket &)
void handleInspectHonorStatsOpcode(WorldPacket &recvPacket)
void handleGroupAcceptOpcode(WorldPacket &)
void handleGameobjReportUseOpCode(WorldPacket &recvPacket)
void handleRequestHotfix(WorldPacket &recvPacket)
void handleLootMasterGiveOpcode(WorldPacket &recvPacket)
void handleLearnPreviewTalentsOpcode(WorldPacket &recvPacket)
void handleBattlefieldPortOpcode(WorldPacket &recvPacket)
void handlePushQuestToPartyOpcode(WorldPacket &recvPacket)
void handleBuyBackOpcode(WorldPacket &recvPacket)
void handleCharDeleteOpcode(WorldPacket &recvPacket)
void handleInspectOpcode(WorldPacket &recvPacket)
void handleEquipmentSetSave(WorldPacket &recvPacket)
void handleRemoveGlyph(WorldPacket &recvPacket)
void handleEnterVehicle(WorldPacket &recvPacket)
void handleSetGuildBankText(WorldPacket &recvPacket)
void handleGuildBankBuyTab(WorldPacket &recvPacket)
void handleLogDisconnectOpcode(WorldPacket &recvPacket)
void handleChannelUnmoderator(WorldPacket &recvPacket)
void handleRequestAccountData(WorldPacket &recvPacket)
void handleGuildBankQueryTab(WorldPacket &recvPacket)
void handleTaxiQueryAvaibleNodesOpcode(WorldPacket &recvPacket)
void handleTakeMoneyOpcode(WorldPacket &recvPacket)
void handleTrainerBuySpellOpcode(WorldPacket &recvPacket)
void handlePetLearnTalent(WorldPacket &recvPacket)
void handlePlayerLoginOpcode(WorldPacket &recvPacket)
void handleGuildSetNoteOpcode(WorldPacket &recvPacket)
void handleSuggestionOpcode(WorldPacket &recvPacket)
void handleGameObjectUse(WorldPacket &recvPacket)
void handleCancelAuction(WorldPacket &recvPacket)
void handleSetWatchedFactionIndexOpcode(WorldPacket &recvPacket)
void handleGuildRoster(WorldPacket &)
void handleGossipHelloOpcode(WorldPacket &recvPacket)
void handleBusyTrade(WorldPacket &)
void handleGetMailOpcode(WorldPacket &)
void handleOpenItemOpcode(WorldPacket &recvPacket)
void handleReportPlayerOpcode(WorldPacket &recvPacket)
void handlePetNameQuery(WorldPacket &recvPacket)
void handleItemRefundInfoOpcode(WorldPacket &recvPacket)
void handleRepairItemOpcode(WorldPacket &recvPacket)
void handleBattlefieldStatusOpcode(WorldPacket &)
void handleQuestgiverStatusQueryOpcode(WorldPacket &recvPacket)
void handleGuildBankMoneyWithdrawn(WorldPacket &)
void handleCharterSign(WorldPacket &recvPacket)
void handleIgnoreTrade(WorldPacket &)
void handleSetTradeItem(WorldPacket &recvPacket)
void handleVoidStorageUnlock(WorldPacket &recvData)
void handleItemRefundRequestOpcode(WorldPacket &recvPacket)
void handleLfgSetRolesOpcode(WorldPacket &recvPacket)
void handleSetTradeGold(WorldPacket &recvPacket)
void handleRequestPvPRewardsOpcode(WorldPacket &)
void handleArenaTeamPromoteOpcode(WorldPacket &recvPacket)
void handleFriendListOpcode(WorldPacket &recvPacket)
void handleDismountOpcode(WorldPacket &)
void handleReadItemOpcode(WorldPacket &recvPacket)
void handleVoidStorageTransfer(WorldPacket &recvData)
void handleAreaSpiritHealerQueryOpcode(WorldPacket &recvPacket)
void handleSellItemOpcode(WorldPacket &recvPacket)
void handleAuctionListBidderItems(WorldPacket &recvPacket)
void handleReadyForAccountDataTimes(WorldPacket &)
void handleCompleteCinematic(WorldPacket &)
void handleGuildFinderGetApplications(WorldPacket &)
void handleGuildSetPublicNote(WorldPacket &recvPacket)
void handleAuctionHelloOpcode(WorldPacket &recvPacket)
void handleRequestVehicleSwitchSeat(WorldPacket &recvPacket)
void handlePetAction(WorldPacket &recvPacket)
void handleStableSwapPet(WorldPacket &recvPacket)
void handleQuestgiverAcceptQuestOpcode(WorldPacket &recvPacket)
void handleChannelAnnounce(WorldPacket &recvPacket)
void handleGuildFinderGetRecruits(WorldPacket &recvPacket)
void handleCalendarEventModeratorStatus(WorldPacket &recvPacket)
void handleLeaveVehicle(WorldPacket &)
void handleArenaJoinOpcode(WorldPacket &recvPacket)
void handleCalendarGetCalendar(WorldPacket &)
void handleTaxiNodeStatusQueryOpcode(WorldPacket &recvPacket)
void handleGuildFinderSetGuildPost(WorldPacket &recvPacket)
void handleGuildBankLogQuery(WorldPacket &recvPacket)
void handleNpcTextQueryOpcode(WorldPacket &recvPacket)
void handleRepopRequestOpcode(WorldPacket &)
void handleGuildLeader(WorldPacket &recvPacket)
void handleGuildBankUpdateTab(WorldPacket &recvPacket)
void handleAuctionSellItem(WorldPacket &recvPacket)
void handleGMSurveySubmitOpcode(WorldPacket &recvPacket)
void handleChannelKick(WorldPacket &recvPacket)
void handleGMTicketToggleSystemStatusOpcode(WorldPacket &)
void handleActivateTaxiOpcode(WorldPacket &recvPacket)
void handleReportSpamOpcode(WorldPacket &recvPacket)
void handleSelfResurrect(WorldPacket &)
void handleUnlearnTalents(WorldPacket &recvPacket)
void handleUpdateAccountData(WorldPacket &recvPacket)
void handleGameObjectQueryOpcode(WorldPacket &recvPacket)
void handleQuestgiverChooseRewardOpcode(WorldPacket &recvPacket)
void handleGroupChangeSubGroup(WorldPacket &recvPacket)
void handleAmmoSetOpcode(WorldPacket &recvPacket)
void handleGroupAssistantLeader(WorldPacket &recvPacket)
void handleSaveGuildEmblem(WorldPacket &recvPacket)
void handleGuildDecline(WorldPacket &)
void handleGroupRequestJoinUpdatesOpcode(WorldPacket &)
void handleCalendarRemoveEvent(WorldPacket &recvPacket)
void handleGuildDemote(WorldPacket &recvPacket)
void handleGroupInviteOpcode(WorldPacket &recvPacket)
void handleCharterTurnInCharter(WorldPacket &recvPacket)
void handleAcceptTrade(WorldPacket &)
void handleAcknowledgementOpcodes(WorldPacket &recvPacket)
void handleQuestgiverCompleteQuestOpcode(WorldPacket &recvPacket)
void handleStabledPetList(WorldPacket &recvPacket)
void handleListInventoryOpcode(WorldPacket &recvPacket)
void handleCalendarGetEvent(WorldPacket &recvPacket)
void handleUnregisterAddonPrefixesOpcode(WorldPacket &)
void handleChannelBan(WorldPacket &recvPacket)
void handleViolenceLevel(WorldPacket &recvPacket)
void handleDungeonDifficultyOpcode(WorldPacket &recvPacket)
void handleSpiritHealerActivateOpcode(WorldPacket &)
void handleRequestRatedBgStatsOpcode(WorldPacket &)
void handleInstanceLockResponse(WorldPacket &recvPacket)
void handleCharterShowSignatures(WorldPacket &recvPacket)
void handleQuestlogRemoveQuestOpcode(WorldPacket &recvPacket)
void handleCreatureQueryOpcode(WorldPacket &recvPacket)
void handlePetCancelAura(WorldPacket &recvPacket)
void HandleMirrorImageOpcode(WorldPacket &recvPacket)
void handleUpdateProjectilePosition(WorldPacket &recvPacket)
void handleEquipmentSetDelete(WorldPacket &recvPacket)
void handleGroupDeclineOpcode(WorldPacket &)
void handleReportLag(WorldPacket &recvPacket)
void handleCalendarEventStatus(WorldPacket &recvPacket)
void handleInitiateTradeOpcode(WorldPacket &recvPacket)
void handleCalendarArenaTeam(WorldPacket &recvPacket)
void handleToggleCloakOpcode(WorldPacket &)
void handleCharRenameOpcode(WorldPacket &recvPacket)
void handleGroupUninviteGuidOpcode(WorldPacket &recvPacket)
void handleLootOpcode(WorldPacket &recvPacket)
void handleStablePet(WorldPacket &)
void handleArenaTeamInviteDenyOpcode(WorldPacket &)
void handleGroupRoleCheckBeginOpcode(WorldPacket &recvPacket)
void handleRequestRaidInfoOpcode(WorldPacket &)
void handleAuctionListOwnerItems(WorldPacket &recvPacket)
void handleCancelAuraOpcode(WorldPacket &recvPacket)
void handleAuctionListItems(WorldPacket &recvPacket)
void handleSetTaxiBenchmarkOpcode(WorldPacket &recvPacket)
void handleLootRollOpcode(WorldPacket &recvPacket)
void handleRaidDifficultyOpcode(WorldPacket &recvPacket)
void handleMoveWorldportAckOpcode(WorldPacket &)
void handleLfgLockInfoOpcode(WorldPacket &recvPacket)
void handleReadyCheckOpcode(WorldPacket &recvPacket)
void handleAttackStopOpcode(WorldPacket &)
void handleGuildPromote(WorldPacket &recvPacket)
void handleLfgProposalResultOpcode(WorldPacket &recvPacket)
void handleCalendarEventInvite(WorldPacket &recvPacket)
void handleGuildLog(WorldPacket &)
void handleCalendarGetNumPending(WorldPacket &)
void handleSendMailOpcode(WorldPacket &recvPacket)
void handleGuildBankWithdrawMoney(WorldPacket &recvPacket)
void handleSetFriendNote(WorldPacket &recvPacket)
void handleChannelSetOwner(WorldPacket &recvPacket)
void handleAutoStoreBagItemOpcode(WorldPacket &recvPacket)
void handleGuildNewsUpdateStickyOpcode(WorldPacket &recvPacket)
void handleCancelTemporaryEnchantmentOpcode(WorldPacket &recvPacket)
void handleTransmogrifyItems(WorldPacket &recvData)
void handleMoveNotActiveMoverOpcode(WorldPacket &recvPacket)
void handleSetPlayerDeclinedNamesOpcode(WorldPacket &recvPacket)
void handleCharterShowListOpcode(WorldPacket &recvPacket)
void handleCharEnumOpcode(WorldPacket &)
void handleAutoEquipItemSlotOpcode(WorldPacket &recvPacket)
void handleQuestQueryOpcode(WorldPacket &recvPacket)
Here is the caller graph for this function:

◆ sendAccountDataTimes()

void WorldSession::sendAccountDataTimes ( uint32_t  mask)

Definition at line 2510 of file MiscHandler.cpp.

2511{
2512 SendPacket(SmsgAccountDataTimes(static_cast<uint32_t>(UNIXTIME), 1, mask, NUM_ACCOUNT_DATA_TYPES).serialise().get());
2513}
@ NUM_ACCOUNT_DATA_TYPES
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendAddonInfo()

void WorldSession::sendAddonInfo ( )

Definition at line 2148 of file MiscHandler.cpp.

2149{
2150#if VERSION_STRING >= Cata
2151#if VERSION_STRING < Mop
2153 for (auto itr : m_addonList)
2154 {
2155 data << uint8_t(itr.state);
2156
2157 uint8_t crcpub = itr.usePublicKeyOrCRC;
2158 data << uint8_t(crcpub);
2159 if (crcpub)
2160 {
2161 uint8_t usepk = (itr.crc != STANDARD_ADDON_CRC); // standard addon CRC
2162 data << uint8_t(usepk);
2163 if (usepk) // add public key if crc is wrong
2164 {
2165 sLogger.debug("AddOn: {}: CRC checksum mismatch: got 0x{:x} - expected 0x{:x} - sending pubkey to accountID {}",
2166 itr.name, itr.crc, STANDARD_ADDON_CRC, GetAccountId());
2167
2168 data.append(PublicKey, sizeof(PublicKey));
2169 }
2170
2171 data << uint32_t(0);
2172 }
2173
2174 data << uint8_t(0);
2175 }
2176
2177 m_addonList.clear();
2178
2179 std::list<BannedAddon> const* bannedAddons = sAddonMgr.getBannedAddonsList();
2180 data << uint32_t(bannedAddons->size());
2181 for (auto itr = bannedAddons->begin(); itr != bannedAddons->end(); ++itr)
2182 {
2183 data << uint32_t(itr->id);
2184 data.append(itr->nameMD5, sizeof(itr->nameMD5));
2185 data.append(itr->versionMD5, sizeof(itr->versionMD5));
2186 data << uint32_t(itr->timestamp);
2187 data << uint32_t(1); // banned?
2188 }
2189
2190 SendPacket(&data);
2191#else
2192 WorldPacket data(SMSG_ADDON_INFO, 1000);
2193
2194 std::list<BannedAddon> const* bannedAddons = sAddonMgr.getBannedAddonsList();
2195
2196 data.writeBits(static_cast<uint32_t>(bannedAddons->size()), 18);
2197 data.writeBits(static_cast<uint32_t>(m_addonList.size()), 23);
2198
2199 for (auto itr : m_addonList)
2200 {
2201 data.writeBit(0); // Has URL
2202 data.writeBit(itr.enabled);
2203 data.writeBit(!itr.usePublicKeyOrCRC);
2204 }
2205
2206 data.flushBits();
2207
2208 for (auto itr : m_addonList)
2209 {
2210 if (!itr.usePublicKeyOrCRC)
2211 {
2212 size_t pos = data.wpos();
2213 for (int i = 0; i < 256; i++)
2214 data << uint8_t(0);
2215
2216 for (int i = 0; i < 256; i++)
2217 data.put(pos + publicKeyOrder[i], PublicKey[i]);
2218 }
2219
2220 if (itr.enabled)
2221 {
2222 data << uint8_t(itr.enabled);
2223 data << uint64_t(0); // sch: normal value - uint32_t
2224 }
2225
2226 data << uint8_t(itr.state);
2227 }
2228
2229 m_addonList.clear();
2230
2231 for (auto itr = bannedAddons->begin(); itr != bannedAddons->end(); ++itr)
2232 {
2233 data << uint32_t(itr->id);
2234 data << uint32_t(1); // banned?
2235
2236 for (int32_t i = 0; i < 8; i++)
2237 data << uint32_t(0);
2238
2239 data << uint32_t(itr->timestamp);
2240 }
2241
2242 SendPacket(&data);
2243#endif
2244#endif
2245}
#define STANDARD_ADDON_CRC
Definition AddonMgr.h:17
static uint8_t publicKeyOrder[256]
Definition AddonMgr.h:81
static uint8_t PublicKey[256]
Definition AddonMgr.h:61
@ SMSG_ADDON_INFO
Definition Opcodes.hpp:821
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendAuctionList()

void WorldSession::sendAuctionList ( Creature creature)

Definition at line 117 of file NPCHandler.cpp.

118{
119 if (creature == nullptr)
120 return;
121
122 const auto auctionHouse = sAuctionMgr.getAuctionHouse(creature->getEntry());
123 if (auctionHouse == nullptr)
124 return;
125
126 SendPacket(MsgAuctionHello(creature->getGuid(), auctionHouse->getId(), auctionHouse->isEnabled ? 1U : 0U).serialise().get());
127}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendBankerList()

void WorldSession::sendBankerList ( Creature creature)

Definition at line 93 of file NPCHandler.cpp.

94{
95 if (creature == nullptr)
96 return;
97
98 SendPacket(SmsgShowBank(creature->getGuid()).serialise().get());
99}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendBattlegroundList()

void WorldSession::sendBattlegroundList ( Creature creature,
uint32_t  mapId 
)

Definition at line 272 of file BattlegroundHandler.cpp.

273{
274 if (creature == nullptr)
275 return;
276
277 WoWGuid guid;
278
279 uint32_t battlegroundType = BattlegroundDef::TYPE_WARSONG_GULCH;
280 if (mapId == 0)
281 {
282 if (creature->GetCreatureProperties()->SubName != "Arena")
283 {
284 battlegroundType = BattlegroundDef::TYPE_ARENA_2V2;
285 }
286 else
287 {
288 if (const auto battleMaster = sMySQLStore.getBattleMaster(creature->GetCreatureProperties()->Id))
289 {
290 battlegroundType = battleMaster->battlegroundId;
291 guid.Init(creature->getGuid());
292 }
293 }
294 }
295 else
296 {
297 battlegroundType = mapId;
298 }
299
300#if VERSION_STRING <= WotLK
301 sBattlegroundManager.handleBattlegroundListPacket(this, battlegroundType);
302#else
303 sBattlegroundManager.handleBattlegroundListPacket(guid, this, battlegroundType);
304#endif
305}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendBuyFailed()

void WorldSession::sendBuyFailed ( uint64_t  guid,
uint32_t  itemid,
uint8_t  error 
)

Definition at line 3181 of file ItemHandler.cpp.

3182{
3183 SendPacket(SmsgBuyFailed(guid, itemid, error).serialise().get());
3184}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendCalendarRaidLockout()

void WorldSession::sendCalendarRaidLockout ( InstanceSaved const *  save,
bool  add 
)

Definition at line 156 of file CalendarHandler.cpp.

157{
158#if VERSION_STRING > TBC
159 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "SMSG_CALENDAR_RAID_LOCKOUT_ADDED/REMOVED");
160 const auto now = Util::getTimeNow();
161 time_t currTime = now;
162
163 WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_REMOVED, (4) + 4 + 4 + 4 + 8);
164 if (add)
165 {
166 data.SetOpcode(SMSG_CALENDAR_RAID_LOCKOUT_ADDED);
167 data.appendPackedTime(currTime);
168 }
169
170 data << uint32_t(save->getMapId());
171 data << uint32_t(save->getDifficulty());
172 data << uint32_t(save->getResetTime() - currTime);
173 data << uint64_t(save->getInstanceId());
174 SendPacket(&data);
175#endif
176}
@ SMSG_CALENDAR_RAID_LOCKOUT_ADDED
Definition Opcodes.hpp:1218
@ SMSG_CALENDAR_RAID_LOCKOUT_REMOVED
Definition Opcodes.hpp:1219
time_t getTimeNow()
Definition Util.cpp:135
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendCalendarRaidLockoutUpdated()

void WorldSession::sendCalendarRaidLockoutUpdated ( InstanceSaved const *  save)

Definition at line 178 of file CalendarHandler.cpp.

179{
180#if VERSION_STRING > TBC
181 if (!save)
182 return;
183
184 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [{}] Map: {}, Difficulty {}", _player->getGuid(), save->getMapId(), save->getDifficulty());
185
186 const auto now = Util::getTimeNow();
187 time_t currTime = now;
188
189 WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8);
190 data.appendPackedTime(currTime);
191 data << uint32_t(save->getMapId());
192 data << uint32_t(save->getDifficulty());
193 data << uint32_t(0); // Amount of seconds that has changed to the reset time
194 data << uint32_t(save->getResetTime() - currTime);
195 SendPacket(&data);
196#endif
197}
@ SMSG_CALENDAR_RAID_LOCKOUT_UPDATED
Definition Opcodes.hpp:1596
Here is the call graph for this function:

◆ sendCharterRequest()

void WorldSession::sendCharterRequest ( Creature creature)

Definition at line 221 of file NPCHandler.cpp.

222{
223 if (creature == nullptr)
224 return;
225
226 SendPacket(SmsgPetitionShowlist(creature->getGuid(), creature->isTabardDesigner()).serialise().get());
227}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendChatPacket()

void WorldSession::SendChatPacket ( WorldPacket data,
uint32_t  langpos,
int32_t  lang,
WorldSession originator 
)

Definition at line 558 of file WorldSession.cpp.

559{
560 if (lang == -1)
561 *reinterpret_cast<uint32_t*>(& data->contents()[langpos]) = lang;
562 else
563 {
564 if (CanUseCommand('c') || (originator && originator->CanUseCommand('c')))
565 *reinterpret_cast<uint32_t*>(& data->contents()[langpos]) = LANG_UNIVERSAL;
566 else
567 *reinterpret_cast<uint32_t*>(& data->contents()[langpos]) = lang;
568 }
569
570 SendPacket(data);
571}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendClientCacheVersion()

void WorldSession::sendClientCacheVersion ( uint32_t  version)

Definition at line 2501 of file MiscHandler.cpp.

2502{
2503#if VERSION_STRING > TBC
2505 data << uint32_t(version);
2506 SendPacket(&data);
2507#endif
2508}
@ SMSG_CLIENTCACHE_VERSION
Definition Opcodes.hpp:1327
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendDiscoverNewTaxiNode()

void WorldSession::sendDiscoverNewTaxiNode ( uint32_t  nodeid)

Definition at line 99 of file TaxiHandler.cpp.

100{
101 if (GetPlayer()->m_taxi->setTaximaskNode(nodeid))
102 {
103 GetPlayer()->sendPacket(SmsgNewTaxiPath().serialise().get());
104 }
105}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendDoFlight()

void WorldSession::sendDoFlight ( uint32_t  mountDisplayId,
uint32_t  path,
uint32_t  pathNode = 0 
)

Definition at line 62 of file TaxiHandler.cpp.

63{
64 TaxiPathNodeList const& nodes = sTaxiPathNodesByPath[path];
65 if (nodes.size() < pathNode)
66 {
67 sLogger.failure("Taxi cannot be Started PathId {} contains {} nodes but Startnode was set to {}", path, nodes.size(), pathNode);
68 return;
69 }
70
71 // remove fake death
72 if (GetPlayer()->hasUnitStateFlag(UNIT_STATE_DIED))
74
75 if (mountDisplayId)
76 GetPlayer()->mount(mountDisplayId);
77
78 GetPlayer()->m_taxi->setNodeAfterTeleport(0);
79 GetPlayer()->getMovementManager()->moveTaxiFlight(path, pathNode);
80}
TaxiPathNodesByPath sTaxiPathNodesByPath
std::vector< WDB::Structures::TaxiPathNodeEntry const * > TaxiPathNodeList
void moveTaxiFlight(uint32_t path, uint32_t pathnode)
void mount(uint32_t mount, uint32_t vehicleId=0, uint32_t creatureEntry=0)
Definition Unit.cpp:8551
MovementManager * getMovementManager()
Definition Unit.hpp:655
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendEmptyGroupList()

void WorldSession::sendEmptyGroupList ( Player player)

Definition at line 37 of file GroupHandler.cpp.

38{
39#if VERSION_STRING >= Cata
40 player->sendPacket(SmsgGroupList().serialise().get());
41#endif
42}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendInnkeeperBind()

void WorldSession::sendInnkeeperBind ( Creature creature)

Definition at line 322 of file NPCHandler.cpp.

323{
324 // Check if the bind position is same as old bind position
325 // but do not send error if player has no Hearthstone
326 if (_player->hasItem(6948) && _player->isInRange(_player->getBindPosition(), 10.0f * 10.0f))
327 {
328 SendPacket(SmsgGossipComplete().serialise().get());
329
330 // Send "already bound here" packet
332 data << uint32_t(1);
333 SendPacket(&data);
334 return;
335 }
336
338 {
339 SendPacket(SmsgGossipComplete().serialise().get());
340
342
344 return;
345 }
346
348 SendPacket(SmsgGossipComplete().serialise().get());
349 creature->castSpell(_player->getGuid(), 3286, true);
350}
@ SMSG_PLAYERBINDERROR
Definition Opcodes.hpp:487
bool m_hasBindDialogOpen
Definition Player.hpp:1234
bool hasItem(uint32_t itemId, uint32_t amount=1, bool checkBankAlso=false) const
Definition Player.cpp:6641
LocationVector getBindPosition() const
Definition Player.cpp:7816
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendInventoryList()

void WorldSession::sendInventoryList ( Creature pCreature)

Definition at line 2314 of file ItemHandler.cpp.

2315{
2316 if (!unit->HasItems())
2317 {
2318 _player->getSession()->systemMessage("No sell template found. Report this to database's devs: {} ({})",
2319 unit->getEntry(), unit->GetCreatureProperties()->Name);
2320 sLogger.failure("'{}' discovered that a creature with entry {} ({}) has no sell template.",
2321 _player->getName(), unit->getEntry(), unit->GetCreatureProperties()->Name);
2323 return;
2324 }
2325
2326#if VERSION_STRING < Cata
2327 WorldPacket data((unit->GetSellItemCount() * 28 + 9)); // allocate
2328 data.SetOpcode(SMSG_LIST_INVENTORY);
2329 data << unit->getGuid();
2330 data << uint8_t(0); // placeholder for item count
2331#else
2332 WorldPacket data(((unit->GetSellItemCount()) + 12)); // allocate
2333 ByteBuffer itemsData(32 * unit->GetSellItemCount());
2334 std::vector<bool> enablers;
2335 enablers.reserve(2 * unit->GetSellItemCount());
2336
2337#endif
2338
2339 uint32_t counter = 0;
2340 for (auto sellItem : *unit->getSellItems())
2341 {
2342 if (sellItem.itemid)
2343 {
2344 if (const auto curItem = sMySQLStore.getItemProperties(sellItem.itemid))
2345 {
2346 // looking up everything for active gms
2347 if (!_player->isGMFlagSet() && !worldConfig.player.showAllVendorItems)
2348 {
2349 if (curItem->AllowableClass && !(_player->getClassMask() & curItem->AllowableClass))
2350 continue;
2351
2352 if (curItem->AllowableRace && !(_player->getRaceMask() & curItem->AllowableRace))
2353 continue;
2354
2355 if (curItem->HasFlag2(ITEM_FLAG2_HORDE_ONLY) && !_player->isTeamHorde())
2356 continue;
2357
2358 if (curItem->HasFlag2(ITEM_FLAG2_ALLIANCE_ONLY) && !_player->isTeamAlliance())
2359 continue;
2360 }
2361
2362 uint32_t av_am = sellItem.max_amount > 0 ? sellItem.available_amount : 0xFFFFFFFF;
2363 uint32_t price = 0;
2364 if (sellItem.extended_cost == nullptr || curItem->HasFlag2(ITEM_FLAG2_EXT_COST_REQUIRES_GOLD))
2365 {
2366 uint32_t factionStanding = _player->getFactionStandingRank(unit->m_factionTemplate->Faction);
2367 price = curItem->getBuyPriceForItem(1, factionStanding);
2368 }
2369
2370#if VERSION_STRING < Cata
2371 data << uint32_t(counter + 1); // we start from 0 but client starts from 1
2372 data << uint32_t(curItem->ItemId);
2373 data << uint32_t(curItem->DisplayInfoID);
2374 data << uint32_t(av_am);
2375 data << uint32_t(price);
2376 data << uint32_t(curItem->MaxDurability);
2377 data << uint32_t(sellItem.amount);
2378
2379
2380 if (sellItem.extended_cost != nullptr)
2381 data << uint32_t(sellItem.extended_cost->costid);
2382 else
2383 data << uint32_t(0);
2384#else
2385 itemsData << uint32_t(counter + 1); // client expects counting to start at 1
2386 itemsData << uint32_t(curItem->MaxDurability);
2387 if (sellItem.extended_cost != nullptr)
2388 {
2389 enablers.push_back(0);
2390 itemsData << uint32_t(sellItem.extended_cost->costid);
2391 }
2392 else
2393 {
2394 enablers.push_back(1);
2395 }
2396
2397 enablers.push_back(1); // unk bit
2398
2399 itemsData << uint32_t(curItem->ItemId);
2400 itemsData << uint32_t(1); // 1 is items, 2 is currency
2401 itemsData << uint32_t(price);
2402 itemsData << uint32_t(curItem->DisplayInfoID);
2403 itemsData << int32_t(av_am);
2404 itemsData << uint32_t(sellItem.amount);
2405#endif
2406
2407 ++counter;
2408 if (counter >= creatureMaxInventoryItems)
2409 break;
2410 }
2411 }
2412 }
2413
2414#if VERSION_STRING < Cata
2415 data.contents()[8] = static_cast<uint8_t>(counter);
2416#else
2417 ObjectGuid guid = unit->getGuid();
2418
2419 data.SetOpcode(SMSG_LIST_INVENTORY);
2420 data.writeBit(guid[1]);
2421 data.writeBit(guid[0]);
2422
2423 data.writeBits(counter, 21); // item count
2424
2425 data.writeBit(guid[3]);
2426 data.writeBit(guid[6]);
2427 data.writeBit(guid[5]);
2428 data.writeBit(guid[2]);
2429 data.writeBit(guid[7]);
2430
2431 for (std::vector<bool>::const_iterator itr = enablers.begin(); itr != enablers.end(); ++itr)
2432 data.writeBit(*itr);
2433
2434 data.writeBit(guid[4]);
2435
2436 data.flushBits();
2437 data.append(itemsData);
2438
2439 data.WriteByteSeq(guid[5]);
2440 data.WriteByteSeq(guid[4]);
2441 data.WriteByteSeq(guid[1]);
2442 data.WriteByteSeq(guid[0]);
2443 data.WriteByteSeq(guid[6]);
2444
2445 data << uint8_t(counter == 0); // unk byte, item count 0: 1, item count != 0: 0 or some "random" value below 300
2446
2447 data.WriteByteSeq(guid[2]);
2448 data.WriteByteSeq(guid[3]);
2449 data.WriteByteSeq(guid[7]);
2450#endif
2451
2452 SendPacket(&data);
2453
2454 sLogger.debug("Sent SMSG_LIST_INVENTORY");
2455}
const uint32_t creatureMaxInventoryItems
@ ITEM_FLAG2_EXT_COST_REQUIRES_GOLD
@ SMSG_LIST_INVENTORY
Definition Opcodes.hpp:460
static void senGossipComplete(Player *player)
bool isTeamHorde() const
Definition Player.cpp:2787
bool isTeamAlliance() const
Definition Player.cpp:2788
Standing getFactionStandingRank(uint32_t faction)
Definition Player.cpp:11519
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendItemDb2Reply()

void WorldSession::sendItemDb2Reply ( uint32_t  entry)
protected

Definition at line 1269 of file MiscHandler.cpp.

1270{
1271#if VERSION_STRING >= Cata
1272#if VERSION_STRING < Mop
1273 WorldPacket data(SMSG_DB_REPLY, 44);
1274 ItemProperties const* proto = sMySQLStore.getItemProperties(entry);
1275 if (!proto)
1276 {
1277 data << uint32_t(-1); // entry
1278 data << uint32_t(DB2_REPLY_ITEM);
1279 data << uint32_t(1322512289); // hotfix date
1280 data << uint32_t(0); // size of next block
1281 return;
1282 }
1283
1284 data << uint32_t(entry);
1285 data << uint32_t(DB2_REPLY_ITEM);
1286 data << uint32_t(1322512290); // hotfix date
1287
1288 ByteBuffer buff;
1289 buff << uint32_t(entry);
1290 buff << uint32_t(proto->Class);
1291 buff << uint32_t(proto->SubClass);
1292 buff << int32_t(0); // unk?
1293 buff << uint32_t(proto->LockMaterial);
1294 buff << uint32_t(proto->DisplayInfoID);
1295 buff << uint32_t(proto->InventoryType);
1296 buff << uint32_t(proto->SheathID);
1297
1298 data << uint32_t(buff.size());
1299 data.append(buff);
1300
1301 SendPacket(&data);
1302#endif
1303#endif
1304}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendItemSparseDb2Reply()

void WorldSession::sendItemSparseDb2Reply ( uint32_t  entry)
protected

Definition at line 1306 of file MiscHandler.cpp.

1307{
1308#if VERSION_STRING >= Cata
1309#if VERSION_STRING < Mop
1310 WorldPacket data(SMSG_DB_REPLY, 526);
1311 ItemProperties const* proto = sMySQLStore.getItemProperties(entry);
1312 if (!proto)
1313 {
1314 data << uint32_t(-1); // entry
1315 data << uint32_t(DB2_REPLY_SPARSE);
1316 data << uint32_t(1322512289); // hotfix date
1317 data << uint32_t(0); // size of next block
1318 return;
1319 }
1320
1321 data << uint32_t(entry);
1322 data << uint32_t(DB2_REPLY_SPARSE);
1323 data << uint32_t(1322512290); // hotfix date
1324
1325 ByteBuffer buff;
1326 buff << uint32_t(entry);
1327 buff << uint32_t(proto->Quality);
1328 buff << uint32_t(proto->Flags);
1329 buff << uint32_t(proto->Flags2);
1330 buff << float(1.0f);
1331 buff << float(1.0f);
1332 buff << uint32_t(proto->MaxCount);
1333 buff << int32_t(proto->BuyPrice);
1334 buff << uint32_t(proto->SellPrice);
1335 buff << uint32_t(proto->InventoryType);
1336 buff << int32_t(proto->AllowableClass);
1337 buff << int32_t(proto->AllowableRace);
1338 buff << uint32_t(proto->ItemLevel);
1339 buff << uint32_t(proto->RequiredLevel);
1340 buff << uint32_t(proto->RequiredSkill);
1341 buff << uint32_t(proto->RequiredSkillRank);
1342 buff << uint32_t(0); // req spell
1343 buff << uint32_t(proto->RequiredPlayerRank1);
1344 buff << uint32_t(proto->RequiredPlayerRank2);
1345 buff << uint32_t(proto->RequiredFactionStanding);
1346 buff << uint32_t(proto->RequiredFaction);
1347 buff << int32_t(proto->MaxCount);
1348 buff << int32_t(0); // stackable
1349 buff << uint32_t(proto->ContainerSlots);
1350
1351 auto it = proto->generalStatsMap.begin();
1352 for (uint8_t i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
1353 {
1354 if (it != proto->generalStatsMap.end())
1355 {
1356 data << it->first;
1357 ++it;
1358 }
1359 else
1360 {
1361 data << uint32_t(0);
1362 }
1363 }
1364
1365 auto it2 = proto->generalStatsMap.begin();
1366 for (uint8_t i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
1367 {
1368 if (it2 != proto->generalStatsMap.end())
1369 {
1370 data << it2->second;
1371 ++it;
1372 }
1373 else
1374 {
1375 data << int32_t(0);
1376 }
1377 }
1378
1379 for (uint32_t x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
1380 buff << int32_t(0); // unk
1381
1382 for (uint32_t x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
1383 buff << int32_t(0); // unk
1384
1385 buff << uint32_t(proto->ScalingStatsEntry);
1386 buff << uint32_t(0); // damage type
1387 buff << uint32_t(proto->Delay);
1388 buff << float(40); // ranged range
1389
1390 for (uint32_t x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
1391 buff << int32_t(0);
1392
1393 for (uint32_t x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
1394 buff << uint32_t(0);
1395
1396 for (uint32_t x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
1397 buff << int32_t(0);
1398
1399 for (uint32_t x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
1400 buff << int32_t(0);
1401
1402 for (uint32_t x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
1403 buff << uint32_t(0);
1404
1405 for (uint32_t x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
1406 buff << int32_t(0);
1407
1408 buff << uint32_t(proto->Bonding);
1409
1410 // item name
1411 utf8_string name = proto->Name;
1412 buff << uint16_t(name.length());
1413 if (name.length())
1414 buff << name;
1415
1416 for (uint32_t i = 0; i < 3; ++i) // other 3 names
1417 buff << uint16_t(0);
1418
1419 std::string desc = proto->Description;
1420 buff << uint16_t(desc.length());
1421 if (desc.length())
1422 buff << desc;
1423
1424 buff << uint32_t(proto->PageId);
1425 buff << uint32_t(proto->PageLanguage);
1426 buff << uint32_t(proto->PageMaterial);
1427 buff << uint32_t(proto->QuestId);
1428 buff << uint32_t(proto->LockId);
1429 buff << int32_t(proto->LockMaterial);
1430 buff << uint32_t(proto->SheathID);
1431 buff << int32_t(proto->RandomPropId);
1432 buff << int32_t(proto->RandomSuffixId);
1433 buff << uint32_t(proto->ItemSet);
1434
1435 buff << uint32_t(0);// area
1436 buff << uint32_t(proto->MapID);
1437 buff << uint32_t(proto->BagFamily);
1438 buff << uint32_t(proto->TotemCategory);
1439
1440 for (uint32_t x = 0; x < MAX_ITEM_PROTO_SOCKETS; ++x)
1441 buff << uint32_t(proto->Sockets[x].SocketColor);
1442
1443 for (uint32_t x = 0; x < MAX_ITEM_PROTO_SOCKETS; ++x)
1444 buff << uint32_t(proto->Sockets[x].Unk);
1445
1446 buff << uint32_t(proto->SocketBonus);
1447 buff << uint32_t(proto->GemProperties);
1448 buff << float(proto->ArmorDamageModifier);
1449 buff << int32_t(proto->ExistingDuration);
1450 buff << uint32_t(proto->ItemLimitCategory);
1451 buff << uint32_t(proto->HolidayId);
1452 buff << float(proto->ScalingStatsFlag); // StatScalingFactor
1453 buff << uint32_t(0); // archaeology unk
1454 buff << uint32_t(0); // archaeology findinds count
1455
1456 data << uint32_t(buff.size());
1457 data.append(buff);
1458
1459 SendPacket(&data);
1460#endif
1461#endif
1462}
#define MAX_ITEM_PROTO_SOCKETS
uint32_t ScalingStatsFlag
uint32_t ScalingStatsEntry
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLearnNewTaxiNode()

bool WorldSession::sendLearnNewTaxiNode ( Creature unit)

Definition at line 82 of file TaxiHandler.cpp.

83{
84 // find current node
85 const auto curloc = sTaxiMgr.getNearestTaxiNode(unit->GetPosition(), unit->GetMapId(), GetPlayer()->GetTeam());
86 if (curloc == 0)
87 return true;
88
89 if (GetPlayer()->m_taxi->setTaximaskNode(curloc))
90 {
91 SendPacket(SmsgNewTaxiPath().serialise().get());
92 SendPacket(SmsgTaxinodeStatus(unit->getGuid(), true).serialise().get());
93 return true;
94 }
95
96 return false;
97}
#define sTaxiMgr
Definition TaxiMgr.hpp:156
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLfgBootPlayer()

void WorldSession::sendLfgBootPlayer ( const LfgPlayerBoot pBoot)

Definition at line 353 of file LfgHandler.cpp.

354{
355#if VERSION_STRING > TBC
356 uint64_t guid = _player->getGuid();
357 const LfgAnswer playerVote = pBoot->votes.find(guid)->second;
358 uint8_t votesNum = 0;
359 uint8_t agreeNum = 0;
360 const uint32_t secsleft = uint8_t((pBoot->cancelTime - time(nullptr)) / 1000);
361
362 for (const auto vote : pBoot->votes)
363 {
364 if (vote.second != LFG_ANSWER_PENDING)
365 {
366 ++votesNum;
367 if (vote.second == LFG_ANSWER_AGREE)
368 ++agreeNum;
369 }
370 }
371
372 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "SMSG_LFG_BOOT_PROPOSAL_UPDATE {} inProgress: {} - didVote: {} - agree: {} - victim: {} votes: {} - agrees: {} - left: {} - needed: {} - reason {}",
373 guid, uint8_t(pBoot->inProgress), uint8_t(playerVote != LFG_ANSWER_PENDING), uint8_t(playerVote == LFG_ANSWER_AGREE),
374 pBoot->victim, votesNum, agreeNum, secsleft, pBoot->votedNeeded, pBoot->reason);
375
376 WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + pBoot->reason.length());
377
378 data << uint8_t(pBoot->inProgress); // Vote in progress
379 data << uint8_t(playerVote != LFG_ANSWER_PENDING); // Did Vote
380 data << uint8_t(playerVote == LFG_ANSWER_AGREE); // Agree
381 data << uint64_t(pBoot->victim); // Victim GUID
382 data << uint32_t(votesNum); // Total Votes
383 data << uint32_t(agreeNum); // Agree Count
384 data << uint32_t(secsleft); // Time Left
385 data << uint32_t(pBoot->votedNeeded); // Needed Votes
386 data << pBoot->reason.c_str(); // Kick reason
387
388 SendPacket(&data);
389#endif
390}
LfgAnswer
Answer state (Also used to check compatibilites)
Definition LFGMgr.hpp:104
@ LFG_ANSWER_PENDING
Definition LFGMgr.hpp:105
@ LFG_ANSWER_AGREE
Definition LFGMgr.hpp:107
@ SMSG_LFG_BOOT_PROPOSAL_UPDATE
Definition Opcodes.hpp:1182
LfgAnswerMap votes
Player votes (-1 not answer | 0 Not agree | 1 agree)
Definition LFGMgr.hpp:237
uint8_t votedNeeded
Votes needed to kick the player.
Definition LFGMgr.hpp:239
std::string reason
kick reason
Definition LFGMgr.hpp:240
time_t cancelTime
Time left to vote.
Definition LFGMgr.hpp:235
bool inProgress
Vote in progress.
Definition LFGMgr.hpp:236
uint64_t victim
Player guid to be kicked (can't vote)
Definition LFGMgr.hpp:238
Here is the call graph for this function:

◆ sendLfgDisabled()

void WorldSession::sendLfgDisabled ( )

Definition at line 65 of file LfgHandler.cpp.

66{
67 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "SMSG_LFG_DISABLED {}", _player->getGuid());
68
70 SendPacket(&data);
71}
@ SMSG_LFG_DISABLED
Definition Opcodes.hpp:1002
Here is the call graph for this function:

◆ sendLfgJoinResult()

void WorldSession::sendLfgJoinResult ( const LfgJoinResultData joinData)

Definition at line 87 of file LfgHandler.cpp.

88{
89#if VERSION_STRING > TBC
90 uint32_t size = 0;
91 for (auto lock : joinData.lockmap)
92 size += 8 + 4 + uint32_t(lock.second.size()) * (4 + 4);
93
94 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "SMSG_LFG_JOIN_RESULT {} heckResult: {} checkValue: {}", _player->getGuid(), joinData.result, joinData.state);
95
96 WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size);
97
98 data << uint32_t(joinData.result); // Check Result
99 data << uint32_t(joinData.state); // Check Value
100 if (!joinData.lockmap.empty())
101 BuildPartyLockDungeonBlock(data, joinData.lockmap);
102 SendPacket(&data);
103#endif
104}
@ SMSG_LFG_JOIN_RESULT
Definition Opcodes.hpp:1174
LfgRoleCheckState state
Definition LFGMgr.hpp:145
LfgJoinResult result
Definition LFGMgr.hpp:144
LfgLockPartyMap lockmap
Definition LFGMgr.hpp:146
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLfgOfferContinue()

void WorldSession::sendLfgOfferContinue ( uint32_t  dungeonEntry)

Definition at line 73 of file LfgHandler.cpp.

74{
75#if VERSION_STRING > TBC
76 SendPacket(SmsgLfgOfferContinue(dungeonEntry).serialise().get());
77#endif
78}
Here is the call graph for this function:

◆ sendLfgPlayerReward()

void WorldSession::sendLfgPlayerReward ( uint32_t  RandomDungeonEntry,
uint32_t  DungeonEntry,
uint8_t  done,
const LfgReward reward,
QuestProperties const *  qReward 
)

Definition at line 313 of file LfgHandler.cpp.

314{
315#if VERSION_STRING > TBC
316 if (!RandomDungeonEntry || !DungeonEntry || !qReward)
317 return;
318
319 uint8_t itemNum = uint8_t(qReward->GetRewardItemCount());
320
321 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "SMSG_LFG_PLAYER_REWARD {} rdungeonEntry: {} - sdungeonEntry: {} - done: {}", _player->getGuid(), RandomDungeonEntry, DungeonEntry, done);
322
323 WorldPacket data(SMSG_LFG_PLAYER_REWARD, 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4 + 1 + itemNum * (4 + 4 + 4));
324
325 data << uint32_t(RandomDungeonEntry); // Random Dungeon Finished
326 data << uint32_t(DungeonEntry); // Dungeon Finished
327 data << uint8_t(done);
328 data << uint32_t(1);
329 data << uint32_t(qReward->reward_money);
330 data << uint32_t(qReward->reward_xp);
331 data << uint32_t(reward->reward[done].variableMoney);
332 data << uint32_t(reward->reward[done].variableXP);
333 data << uint8_t(itemNum);
334
335 if (itemNum)
336 {
337 for (uint8_t i = 0; i < 4; ++i)
338 {
339 if (!qReward->reward_item[i])
340 continue;
341
342 auto itemProperties = sMySQLStore.getItemProperties(qReward->reward_item[i]);
343
344 data << uint32_t(qReward->reward_item[i]);
345 data << uint32_t(itemProperties ? itemProperties->DisplayInfoID : 0);
346 data << uint32_t(qReward->reward_itemcount[i]);
347 }
348 }
349 SendPacket(&data);
350#endif
351}
@ SMSG_LFG_PLAYER_REWARD
Definition Opcodes.hpp:1159
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLfgQueueStatus()

void WorldSession::sendLfgQueueStatus ( uint32_t  dungeon,
int32_t  waitTime,
int32_t  avgWaitTime,
int32_t  waitTimeTanks,
int32_t  waitTimeHealer,
int32_t  waitTimeDps,
uint32_t  queuedTime,
uint8_t  tanks,
uint8_t  healers,
uint8_t  dps 
)

Definition at line 291 of file LfgHandler.cpp.

292{
293#if VERSION_STRING > TBC
294 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "SMSG_LFG_QUEUE_STATUS {} dungeon: {} - waitTime: {} - avgWaitTime: {} - waitTimeTanks: {} - waitTimeHealer: {} - waitTimeDps: {} - queuedTime: {} - tanks: {} - healers: {} - dps: {}", _player->getGuid(), dungeon, waitTime, avgWaitTime, waitTimeTanks, waitTimeHealer, waitTimeDps, queuedTime, tanks, healers, dps);
295
296 WorldPacket data(SMSG_LFG_QUEUE_STATUS, 4 + 4 + 4 + 4 + 4 + 4 + 1 + 1 + 1 + 4);
297
298 data << uint32_t(dungeon); // Dungeon
299 data << int32_t(avgWaitTime); // Average Wait time
300 data << int32_t(waitTime); // Wait Time
301 data << int32_t(waitTimeTanks); // Wait Tanks
302 data << int32_t(waitTimeHealer); // Wait Healers
303 data << int32_t(waitTimeDps); // Wait Dps
304 data << uint8_t(tanks); // Tanks needed
305 data << uint8_t(healers); // Healers needed
306 data << uint8_t(dps); // Dps needed
307 data << uint32_t(queuedTime); // Player wait time in queue
308
309 SendPacket(&data);
310#endif
311}
@ SMSG_LFG_QUEUE_STATUS
Definition Opcodes.hpp:1175
Here is the call graph for this function:

◆ sendLfgRoleCheckUpdate()

void WorldSession::sendLfgRoleCheckUpdate ( const LfgRoleCheck pRoleCheck)

Definition at line 223 of file LfgHandler.cpp.

224{
225#if VERSION_STRING > TBC
226
227 ASSERT(pRoleCheck);
228
229 LfgDungeonSet dungeons;
230 if (pRoleCheck->rDungeonId)
231 dungeons.insert(pRoleCheck->rDungeonId);
232 else
233 dungeons = pRoleCheck->dungeons;
234
235 sLogger.debug("Sent SMSG_LFG_ROLE_CHECK_UPDATE {}", _player->getGuid());
236
237 WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + pRoleCheck->roles.size() * (8 + 1 + 4 + 1));
238
239 data << uint32_t(pRoleCheck->state); // Check result
240 data << uint8_t(pRoleCheck->state == LFG_ROLECHECK_INITIALITING);
241 data << uint8_t(dungeons.size()); // Number of dungeons
242#if VERSION_STRING < Cata
243 if (!dungeons.empty())
244 {
245 for (auto dungeonEntry : dungeons)
246 {
247 auto dungeon = sLFGDungeonStore.lookupEntry(dungeonEntry);
248 data << uint32_t(dungeon ? dungeon->Entry() : 0);
249 }
250 }
251#endif
252
253 data << uint8_t(pRoleCheck->roles.size()); // Players in group
254 if (!pRoleCheck->roles.empty())
255 {
256 // Leader info MUST be sent 1st :S
257 uint64_t guid = pRoleCheck->leader;
258 uint8_t roles = pRoleCheck->roles.find(guid)->second;
259 data << uint64_t(guid); // Guid
260 data << uint8_t(roles > 0); // Ready
261 data << uint32_t(roles); // Roles
262
263 WoWGuid wowGuid;
264 wowGuid.Init(guid);
265
266 Player* player = sObjectMgr.getPlayer(wowGuid.getGuidLowPart());
267 data << uint8_t(player ? player->getLevel() : 0); // Level
268
269 for (const auto rolePair : pRoleCheck->roles)
270 {
271 if (rolePair.first == pRoleCheck->leader)
272 continue;
273
274 WoWGuid guidItr;
275 guidItr.Init(rolePair.first);
276
277 guid = rolePair.first;
278 roles = rolePair.second;
279 data << uint64_t(guid); // Guid
280 data << uint8_t(roles > 0); // Ready
281 data << uint32_t(roles); // Roles
282
283 player = sObjectMgr.getPlayer(guidItr.getGuidLowPart());
284 data << uint8_t(player ? player->getLevel() : 0); // Level
285 }
286 }
287 SendPacket(&data);
288#endif
289}
#define ASSERT
Definition Errors.h:45
@ LFG_ROLECHECK_INITIALITING
Definition LFGMgr.hpp:95
@ SMSG_LFG_ROLE_CHECK_UPDATE
Definition Opcodes.hpp:1173
uint32_t rDungeonId
Random Dungeon Id.
Definition LFGMgr.hpp:228
LfgDungeonSet dungeons
Dungeons group is applying for (expanded random dungeons)
Definition LFGMgr.hpp:227
LfgRoleCheckState state
State of the rolecheck.
Definition LFGMgr.hpp:226
LfgRolesMap roles
Player selected roles.
Definition LFGMgr.hpp:225
uint64_t leader
Leader of the group.
Definition LFGMgr.hpp:229
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLfgRoleChosen()

void WorldSession::sendLfgRoleChosen ( uint64_t  guid,
uint8_t  roles 
)

Definition at line 214 of file LfgHandler.cpp.

215{
216#if VERSION_STRING > TBC
217 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "SMSG_LFG_ROLE_CHOSEN {} guid: {} roles: {}", _player->getGuid(), guid, roles);
218
219 SendPacket(SmsgLfgRoleChosen(guid, roles > 0 ? 1 : 0, roles).serialise().get());
220#endif
221}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLfgTeleportError()

void WorldSession::sendLfgTeleportError ( uint8_t  error)

Definition at line 80 of file LfgHandler.cpp.

81{
82#if VERSION_STRING > TBC
83 SendPacket(SmsgLfgTeleportDenied(error).serialise().get());
84#endif
85}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLfgUpdateParty()

void WorldSession::sendLfgUpdateParty ( const LfgUpdateData updateData)

Definition at line 154 of file LfgHandler.cpp.

155{
156#if VERSION_STRING > TBC
157 bool isJoining = false;
158 bool hasExtraInfo = false;
159 bool isQueued = false;
160
161 switch (updateData.updateType)
162 {
164 hasExtraInfo = true;
165 break;
167 hasExtraInfo = true;
168 isJoining = true;
169 isQueued = true;
170 break;
172 // join = true; // todo: Sometimes queued and hasExtraInfo - Check ocurrences...
173 isQueued = true;
174 break;
176 hasExtraInfo = true;
177 isJoining = true;
178 break;
179 default:
180 break;
181 }
182
183 uint8_t dungeonSize = uint8_t(updateData.dungeons.size());
184
185 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "SMSG_LFG_UPDATE_PARTY {} updatetype: {}", _player->getGuid(), updateData.updateType);
186
187 WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (hasExtraInfo ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + dungeonSize * 4 + updateData.comment.length()));
188
189 data << uint8_t(updateData.updateType); // Lfg Update type
190 data << uint8_t(hasExtraInfo); // Extra info
191 if (hasExtraInfo)
192 {
193 data << uint8_t(isJoining); // LFG Join
194 data << uint8_t(isQueued); // Join the queue
195 data << uint8_t(0); // unk - Always 0
196 data << uint8_t(0); // unk - Always 0
197 for (uint8_t i = 0; i < 3; ++i)
198 data << uint8_t(0); // unk - Always 0
199
200 data << uint8_t(dungeonSize);
201
202 if (dungeonSize)
203 {
204 for (auto dungeonEntry : updateData.dungeons)
205 data << uint32_t(dungeonEntry);
206 }
207
208 data << updateData.comment;
209 }
210 SendPacket(&data);
211#endif
212}
@ LFG_UPDATETYPE_JOIN_PROPOSAL
Definition LFG.hpp:26
@ LFG_UPDATETYPE_ADDED_TO_QUEUE
Definition LFG.hpp:32
@ LFG_UPDATETYPE_PROPOSAL_BEGIN
Definition LFG.hpp:33
@ LFG_UPDATETYPE_CLEAR_LOCK_LIST
Definition LFG.hpp:34
@ SMSG_LFG_UPDATE_PARTY
Definition Opcodes.hpp:1177
LfgDungeonSet dungeons
Definition LFGMgr.hpp:157
std::string comment
Definition LFGMgr.hpp:158
LfgUpdateType updateType
Definition LFGMgr.hpp:156
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLfgUpdatePlayer()

void WorldSession::sendLfgUpdatePlayer ( const LfgUpdateData updateData)

Definition at line 106 of file LfgHandler.cpp.

107{
108#if VERSION_STRING > TBC
109 bool queued = false;
110 bool extrainfo = false;
111
112 switch (updateData.updateType)
113 {
116 queued = true;
117 extrainfo = true;
118 break;
119 //case LFG_UPDATETYPE_CLEAR_LOCK_LIST: // TODO: Sometimes has extrainfo - Check ocurrences...
121 extrainfo = true;
122 break;
123 default:
124 break;
125 }
126
127 uint64_t guid = _player->getGuid();
128 uint8_t size = uint8_t(updateData.dungeons.size());
129
130 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "SMSG_LFG_UPDATE_PLAYER {} updatetype: {}", guid, updateData.updateType);
131
132 WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (extrainfo ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
133
134 data << uint8_t(updateData.updateType); // Lfg Update type
135 data << uint8_t(extrainfo); // Extra info
136 if (extrainfo)
137 {
138 data << uint8_t(queued); // Join the queue
139 data << uint8_t(0); // unk - Always 0
140 data << uint8_t(0); // unk - Always 0
141 data << uint8_t(size);
142 if (size)
143 {
144 for (auto dungeonEntry : updateData.dungeons)
145 data << uint32_t(dungeonEntry);
146 }
147
148 data << updateData.comment;
149 }
150 SendPacket(&data);
151#endif
152}
@ SMSG_LFG_UPDATE_PLAYER
Definition Opcodes.hpp:1176
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLfgUpdateProposal()

void WorldSession::sendLfgUpdateProposal ( uint32_t  proposalId,
const LfgProposal pProp 
)

Definition at line 392 of file LfgHandler.cpp.

393{
394#if VERSION_STRING > TBC
395 if (!pProp)
396 return;
397
398 uint64_t guid = _player->getGuid();
399 auto itPlayer = pProp->players.find(guid);
400 if (itPlayer == pProp->players.end())
401 return;
402
403 LfgProposalPlayer* ppPlayer = itPlayer->second.get();
404 const uint32_t pLowGroupGuid = ppPlayer->groupLowGuid;
405 const uint32_t dLowGuid = pProp->groupLowGuid;
406 uint32_t dungeonId = pProp->dungeonId;
407 bool isSameDungeon = false;
408 bool isContinue = false;
409
410 const auto group = dLowGuid ? sObjectMgr.getGroupById(dLowGuid) : nullptr;
411 uint32_t completedEncounters = 0;
412 if (group)
413 {
414 uint64_t gguid = group->GetGUID();
415 isContinue = group->isLFGGroup() && sLfgMgr.GetState(gguid) != LFG_STATE_FINISHED_DUNGEON;
416 isSameDungeon = _player->getGroup() == group && isContinue;
417 }
418
419 sLogger.debugFlag(AscEmu::Logging::LF_OPCODE, "SMSG_LFG_PROPOSAL_UPDATE {} state: {}", _player->getGuid(), pProp->state);
420 WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + pProp->players.size() * (4 + 1 + 1 + 1 + 1 + 1));
421
422 if (!isContinue) // Only show proposal dungeon if it's continue
423 {
424 LfgDungeonSet playerDungeons = sLfgMgr.GetSelectedDungeons(guid);
425 if (playerDungeons.size() == 1)
426 dungeonId = (*playerDungeons.begin());
427 }
428
429#if VERSION_STRING < Cata
430 if (WDB::Structures::LFGDungeonEntry const* dungeon = sLFGDungeonStore.lookupEntry(dungeonId))
431 {
432 dungeonId = dungeon->Entry();
433
434 // Select a player inside to be get completed encounters from
435 if (group)
436 {
437 for (const auto cachedCharacterInfo : group->GetSubGroup(0)->getGroupMembers())
438 {
439 Player* groupMember = sObjectMgr.getPlayer(cachedCharacterInfo->guid);
440 if (groupMember && groupMember->GetMapId() == uint32_t(dungeon->map))
441 {
442 if (InstanceScript* instance = groupMember->getWorldMap()->getScript())
443 completedEncounters = instance->getCompletedEncounterMask();
444 break;
445 }
446 }
447 }
448 }
449#endif
450
451 data << uint32_t(dungeonId); // Dungeon
452 data << uint8_t(pProp->state); // Result state
453 data << uint32_t(proposalId); // Internal Proposal ID
454 data << uint32_t(completedEncounters); // Bosses killed
455 data << uint8_t(isSameDungeon); // Silent (show client window)
456 data << uint8_t(pProp->players.size()); // Group size
457
458 for (itPlayer = pProp->players.begin(); itPlayer != pProp->players.end(); ++itPlayer)
459 {
460 ppPlayer = itPlayer->second.get();
461 data << uint32_t(ppPlayer->role); // Role
462 data << uint8_t(itPlayer->first == guid); // Self player
463 if (!ppPlayer->groupLowGuid) // Player not it a group
464 {
465 data << uint8_t(0); // Not in dungeon
466 data << uint8_t(0); // Not same group
467 }
468 else
469 {
470 data << uint8_t(ppPlayer->groupLowGuid == dLowGuid); // In dungeon (silent)
471 data << uint8_t(ppPlayer->groupLowGuid == pLowGroupGuid); // Same Group than player
472 }
473 data << uint8_t(ppPlayer->accept != LFG_ANSWER_PENDING); // Answered
474 data << uint8_t(ppPlayer->accept == LFG_ANSWER_AGREE); // Accepted
475 }
476 SendPacket(&data);
477#endif
478}
@ LFG_STATE_FINISHED_DUNGEON
Definition LFG.hpp:47
@ SMSG_LFG_PROPOSAL_UPDATE
Definition Opcodes.hpp:1171
Stores player data related to proposal to join.
Definition LFGMgr.hpp:198
uint8_t role
Proposed role.
Definition LFGMgr.hpp:200
uint32_t groupLowGuid
Original group guid (Low guid) 0 if no original group.
Definition LFGMgr.hpp:202
LfgAnswer accept
Accept status (-1 not answer | 0 Not agree | 1 agree)
Definition LFGMgr.hpp:201
uint32_t dungeonId
Dungeon to join.
Definition LFGMgr.hpp:211
uint32_t groupLowGuid
Proposal group (0 if new)
Definition LFGMgr.hpp:213
LfgProposalPlayerMap players
Players data.
Definition LFGMgr.hpp:217
LfgProposalState state
State of the proposal.
Definition LFGMgr.hpp:212
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendLfgUpdateSearch()

void WorldSession::sendLfgUpdateSearch ( bool  update)

Definition at line 57 of file LfgHandler.cpp.

58{
59#if VERSION_STRING > TBC
60 SendPacket(SmsgLfgUpdateSearch(update).serialise().get());
61#endif
62}
Here is the call graph for this function:

◆ sendMOTD()

void WorldSession::sendMOTD ( )

Definition at line 2515 of file MiscHandler.cpp.

2516{
2517 std::vector<std::string> motdLines;
2518 std::string str_motd = worldConfig.getMessageOfTheDay();
2519 std::string::size_type nextpos;
2520
2521 std::string::size_type pos = 0;
2522 while ((nextpos = str_motd.find('@', pos)) != std::string::npos)
2523 {
2524 if (nextpos != pos)
2525 motdLines.push_back(str_motd.substr(pos, nextpos - pos));
2526
2527 pos = nextpos + 1;
2528 }
2529
2530 if (pos < str_motd.length())
2531 motdLines.push_back(str_motd.substr(pos));
2532
2533#if VERSION_STRING > Classic
2534 SendPacket(SmsgMotd(motdLines).serialise().get());
2535#else
2536 for (const auto& line : motdLines)
2537 GetPlayer()->sendChatMessage(CHAT_MSG_SYSTEM, LANG_UNIVERSAL, line.c_str());
2538#endif
2539}
@ CHAT_MSG_SYSTEM
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendNotification()

void WorldSession::SendNotification ( const char *  message,
  ... 
)

Definition at line 469 of file WorldSession.cpp.

470{
471 if (!message)
472 return;
473
474 va_list ap;
475 va_start(ap, message);
476 char msg1[1024];
477 vsnprintf(msg1, 1024, message, ap);
478 va_end(ap);
479
480 SendPacket(SmsgNotification(msg1).serialise().get());
481}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendPacket()

void WorldSession::SendPacket ( WorldPacket packet)

Definition at line 684 of file WorldSession.cpp.

685{
686 if (packet->GetOpcode() == 0x0000)
687 {
688 sLogger.failure("Return, packet 0x0000 is not a valid packet!");
689 return;
690 }
691
692 if (_socket && _socket->IsConnected())
693 {
694 _socket->SendPacket(packet);
695 }
696}
void SendPacket(WorldPacket *packet)
Definition WorldSocket.h:74
Here is the call graph for this function:

◆ sendReforgeResult()

void WorldSession::sendReforgeResult ( bool  success)

Definition at line 759 of file ItemHandler.cpp.

760{
761#if VERSION_STRING == Cata
763 data.writeBit(success);
764 data.flushBits();
765 SendPacket(&data);
766#endif
767}
@ SMSG_REFORGE_RESULT
Definition Opcodes.hpp:1713
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendRefundInfo()

void WorldSession::sendRefundInfo ( uint64_t  guid)

Definition at line 392 of file ItemHandler.cpp.

393{
394#if VERSION_STRING == WotLK
395 if (!_player || !_player->IsInWorld())
396 return;
397
398 auto item = _player->getItemInterface()->GetItemByGUID(GUID);
399 if (item == nullptr)
400 return;
401
402 if (item->isEligibleForRefund())
403 {
404 std::pair<time_t, uint32_t> RefundEntry = _player->getItemInterface()->LookupRefundable(GUID);
405
406 if (RefundEntry.first == 0 || RefundEntry.second == 0)
407 return;
408
409 auto item_extended_cost = sItemExtendedCostStore.lookupEntry(RefundEntry.second);
410 if (item_extended_cost == nullptr)
411 return;
412
413 ItemProperties const* proto = item->getItemProperties();
414
415 item->setFlags(ITEM_FLAG_REFUNDABLE);
416
418 packet << uint64_t(GUID);
419 packet << uint32_t(proto->BuyPrice);
420 packet << uint32_t(item_extended_cost->honor_points);
421 packet << uint32_t(item_extended_cost->arena_points);
422
423 for (uint8_t i = 0; i < 5; ++i)
424 {
425 packet << uint32_t(item_extended_cost->item[i]);
426 packet << uint32_t(item_extended_cost->count[i]);
427 }
428
429 packet << uint32_t(0);
430
431 uint32_t* played = _player->getPlayedTime();
432
433 if (played[1] > RefundEntry.first + 60 * 60 * 2)
434 packet << uint32_t(0);
435 else
436 packet << uint32_t(RefundEntry.first);
437
438 this->SendPacket(&packet);
439 }
440#elif VERSION_STRING >= Cata
441
442 if (!_player || !_player->IsInWorld())
443 return;
444
445 Item* item = _player->getItemInterface()->GetItemByGUID(GUID);
446 if (item == nullptr)
447 return;
448
449 if (item->isEligibleForRefund())
450 {
451 std::pair<time_t, uint32_t> refundEntryPair = _player->getItemInterface()->LookupRefundable(GUID);
452
453 if (refundEntryPair.first == 0 || refundEntryPair.second == 0)
454 return;
455
456 auto itemExtendedCostEntry = sItemExtendedCostStore.lookupEntry(refundEntryPair.second);
457 if (itemExtendedCostEntry == nullptr)
458 return;
459
460 ItemProperties const* item_properties = item->getItemProperties();
462
463 ObjectGuid objectGuid = item->getGuid();
465 data.writeBit(objectGuid[3]);
466 data.writeBit(objectGuid[5]);
467 data.writeBit(objectGuid[7]);
468 data.writeBit(objectGuid[6]);
469 data.writeBit(objectGuid[2]);
470 data.writeBit(objectGuid[4]);
471 data.writeBit(objectGuid[0]);
472 data.writeBit(objectGuid[1]);
473 data.flushBits();
474 data.WriteByteSeq(objectGuid[7]);
475
476 uint32_t* played = _player->getPlayedTime();
477
478 if (played[1] > (refundEntryPair.first + 60 * 60 * 2))
479 data << uint32_t(0);
480 else
481 data << uint32_t(refundEntryPair.first);
482
483 for (uint8_t i = 0; i < 5; ++i)
484 {
485 data << uint32_t(itemExtendedCostEntry->item[i]);
486 data << uint32_t(itemExtendedCostEntry->count[i]);
487 }
488
489 data.WriteByteSeq(objectGuid[6]);
490 data.WriteByteSeq(objectGuid[4]);
491 data.WriteByteSeq(objectGuid[3]);
492 data.WriteByteSeq(objectGuid[2]);
493 for (uint8_t i = 0; i < 5; ++i)
494 {
495 data << uint32_t(itemExtendedCostEntry->reqcurrcount[i]);
496 data << uint32_t(itemExtendedCostEntry->reqcur[i]);
497 }
498
499 data.WriteByteSeq(objectGuid[1]);
500 data.WriteByteSeq(objectGuid[5]);
501 data << uint32_t(0);
502 data.WriteByteSeq(objectGuid[0]);
503 data << uint32_t(item_properties->BuyPrice);
504
505 SendPacket(&data);
506 }
507#endif
508}
@ ITEM_FLAG_REFUNDABLE
@ SMSG_ITEMREFUNDINFO
Definition Opcodes.hpp:1334
bool isEligibleForRefund()
Definition Item.cpp:1534
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSellItem()

void WorldSession::sendSellItem ( uint64_t  vendorguid,
uint64_t  itemid,
uint8_t  error 
)

Definition at line 3186 of file ItemHandler.cpp.

3187{
3188 WorldPacket data(SMSG_SELL_ITEM, 17);
3189 data << vendorguid;
3190 data << itemid;
3191 data << error;
3192 SendPacket(&data);
3193}
@ SMSG_SELL_ITEM
Definition Opcodes.hpp:462
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendServerStats()

void WorldSession::sendServerStats ( )

Definition at line 583 of file CharacterHandler.cpp.

584{
585 if (worldConfig.server.sendStatsOnJoin)
586 {
587 _player->broadcastMessage("Info: %sAscEmu %s/%s-%s-%s %s(www.ascemu.org)", MSG_COLOR_WHITE, AE_BUILD_HASH, CONFIG, AE_PLATFORM, AE_ARCHITECTURE, MSG_COLOR_SEXBLUE);
588 _player->broadcastMessage("Online Players: %s%u |rPeak: %s%u|r Accepted Connections: %s%u", MSG_COLOR_SEXBLUE,
589 static_cast<uint32_t>(sWorld.getSessionCount()), MSG_COLOR_SEXBLUE, sWorld.getPeakSessionCount(), MSG_COLOR_SEXBLUE, sWorld.getAcceptedConnections());
590
591 _player->broadcastMessage("Uptime: |r%s", sWorld.getWorldUptimeString().c_str());
592 }
593}
#define MSG_COLOR_WHITE
#define MSG_COLOR_SEXBLUE
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSpiritHealerRequest()

void WorldSession::sendSpiritHealerRequest ( Creature creature)

Definition at line 130 of file NPCHandler.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendStabledPetList()

void WorldSession::sendStabledPetList ( uint64_t  npcguid)

Definition at line 381 of file NPCHandler.cpp.

382{
383 std::map<uint8_t, PlayerStablePet> stableList;
384 PlayerStablePet stablePet;
385
386 for (const auto& [petId, cachedPet] : _player->getPetCacheMap())
387 {
388 stablePet.petNumber = petId;
389 stablePet.entry = cachedPet->entry;
390 stablePet.level = cachedPet->level;
391 stablePet.name.assign(cachedPet->name);
392 stableList.emplace(cachedPet->slot, stablePet);
393 }
394
395#if VERSION_STRING >= Cata
396 // Since cata all stable slots are automatically unlocked
397 SendPacket(MsgListStabledPets(npcguid, PET_SLOT_MAX_STABLE_SLOT, stableList).serialise().get());
398#else
399 SendPacket(MsgListStabledPets(npcguid, _player->m_stableSlotCount, stableList).serialise().get());
400#endif
401}
@ PET_SLOT_MAX_STABLE_SLOT
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSystemMessagePacket()

void WorldSession::sendSystemMessagePacket ( std::string &  _message)

Definition at line 553 of file WorldSession.cpp.

554{
555 SendPacket(SmsgMessageChat(SystemMessagePacket(_message)).serialise().get());
556}
Here is the call graph for this function:

◆ sendTabardHelp()

void WorldSession::sendTabardHelp ( Creature creature)

Definition at line 69 of file NPCHandler.cpp.

70{
71 if (creature == nullptr)
72 return;
73
75}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendTaxiMenu()

void WorldSession::sendTaxiMenu ( Creature unit)

Definition at line 45 of file TaxiHandler.cpp.

46{
47 // find current node
48 const auto nearestNode = sTaxiMgr.getNearestTaxiNode(unit->GetPosition(), unit->GetMapId(), GetPlayer()->GetTeam());
49 if (nearestNode == 0)
50 return;
51
52 bool lastTaxiCheaterState = GetPlayer()->m_cheats.hasTaxiCheat;
53 if (unit->getEntry() == 29480)
54 GetPlayer()->m_cheats.hasTaxiCheat = true; // Grimwing in Ebon Hold, special case. NOTE: Not perfect, Zul'Aman should not be included according to WoWhead, and I think taxicheat includes it.
55
56 const auto& taxiMask = GetPlayer()->getTaxiData()->getTaxiMask(GetPlayer()->m_cheats.hasTaxiCheat);
57 SendPacket(SmsgShowTaxiNodes(unit->getGuid(), nearestNode, taxiMask).serialise().get());
58
59 GetPlayer()->m_cheats.hasTaxiCheat = lastTaxiCheaterState;
60}
TaxiPath * getTaxiData() const
Definition Player.hpp:1626
TaxiMask const & getTaxiMask(bool all) const
Definition TaxiMgr.cpp:306
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendTaxiStatus()

void WorldSession::sendTaxiStatus ( WoWGuid  guid)

Definition at line 27 of file TaxiHandler.cpp.

28{
29 Player* const player = GetPlayer();
30 Creature* unit = player->getWorldMapCreature(guid.getRawGuid());
31 if (!unit || unit->isHostileTo(player) || !unit->isTaxi())
32 {
33 sLogger.failure("WorldSession::sendTaxiStatus Creature with guid - {} not found.", std::to_string(unit->getGuid()));
34 return;
35 }
36
37 // find taxi node
38 const auto nearest = sTaxiMgr.getNearestTaxiNode(unit->GetPosition(), unit->GetMapId(), player->GetTeam());
39 if (nearest == 0)
40 return;
41
42 SendPacket(SmsgTaxinodeStatus(guid.getRawGuid(), player->m_taxi->isTaximaskNodeKnown(nearest)).serialise().get());
43}
bool isTaxi() const
Definition Creature.cpp:259
bool isHostileTo(Object *target)
Definition Object.cpp:4031
uint32_t GetTeam() const
Definition Object.cpp:4417
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendTradeResult()

void WorldSession::sendTradeResult ( TradeStatus  result,
uint64_t  guid = 0 
)

Definition at line 621 of file TradeHandler.cpp.

622{
623 WorldPacket data(SMSG_TRADE_STATUS, 4 + 8);
624 data.writeBit(false);
625 data.writeBits(result, 5);
626
627 switch (result)
628 {
630 {
631 ObjectGuid guid;
632
633 data.writeBit(guid[2]);
634 data.writeBit(guid[4]);
635 data.writeBit(guid[6]);
636 data.writeBit(guid[0]);
637 data.writeBit(guid[1]);
638 data.writeBit(guid[3]);
639 data.writeBit(guid[7]);
640 data.writeBit(guid[5]);
641
642 data.flushBits();
643
644 data.WriteByteSeq(guid[4]);
645 data.WriteByteSeq(guid[1]);
646 data.WriteByteSeq(guid[2]);
647 data.WriteByteSeq(guid[3]);
648 data.WriteByteSeq(guid[0]);
649 data.WriteByteSeq(guid[7]);
650 data.WriteByteSeq(guid[6]);
651 data.WriteByteSeq(guid[5]);
652 break;
653 }
655 {
656 data.flushBits();
657 data << uint32_t(0);
658 break;
659 }
661 {
662 data.writeBit(false);
663 data.flushBits();
664 data << uint32_t(0);
665 data << uint32_t(0);
666 break;
667 }
670 {
671 data.flushBits();
672 data << uint8_t(0);
673 break;
674 }
677 {
678 data.flushBits();
679 data << uint32_t(0);
680 data << uint32_t(0);
681 }
682 default:
683 data.flushBits();
684 break;
685 }
686
687 SendPacket(&data);
688}
@ TRADE_STATUS_FAILED
@ TRADE_STATUS_CURRENCY_NOT_TRADEABLE
@ TRADE_STATUS_LOOT_ITEM
@ TRADE_STATUS_CURRENCY
@ TRADE_STATUS_ONLY_CONJURED
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendTradeUpdate()

void WorldSession::sendTradeUpdate ( bool  tradeState = true)

Definition at line 691 of file TradeHandler.cpp.

692{
693 TradeData* tradeData = tradeState ? _player->getTradeData()->getTargetTradeData() : _player->getTradeData();
695
696#if VERSION_STRING < Cata
697 data << uint8_t(tradeState ? 1 : 0);
698 data << uint32_t(0); // unk
699 data << uint32_t(TRADE_SLOT_COUNT);
700 data << uint32_t(TRADE_SLOT_COUNT);
701 data << uint32_t(tradeData->getTradeMoney());
702 data << uint32_t(tradeData->getSpell()); // This is the spell which is casted on the lowest item
703
704 uint8_t itemCount = 0;
705 for (uint8_t i = 0; i < TRADE_SLOT_COUNT; ++i)
706 {
707 data << uint8_t(i);
708
709 const auto item = tradeData->getTradeItem(TradeSlots(i));
710 if (item == nullptr)
711 {
712 // Need to send empty fields, otherwise slots get messed up
713 data << uint32_t(0);
714 data << uint32_t(0);
715 data << uint32_t(0);
716 data << uint32_t(0);
717 data << uint64_t(0);
718 data << uint32_t(0);
719 for (uint8_t ench = SOCK_ENCHANTMENT_SLOT1; ench < BONUS_ENCHANTMENT_SLOT; ++ench)
720 data << uint32_t(0);
721 data << uint64_t(0);
722 data << uint32_t(0);
723 data << uint32_t(0);
724 data << uint32_t(0);
725 data << uint32_t(0);
726 data << uint32_t(0);
727 data << uint32_t(0);
728 continue;
729 }
730
731 ++itemCount;
732 if (const auto itemProperties = item->getItemProperties())
733 {
734 data << uint32_t(itemProperties->ItemId);
735 data << uint32_t(itemProperties->DisplayInfoID);
736 data << uint32_t(item->getStackCount());
737 data << uint32_t(item->hasFlags(ITEM_FLAG_WRAPPED) ? 1 : 0);
738
739 // Enchantment stuff
740 data << uint64_t(item->getGiftCreatorGuid());
741 data << uint32_t(item->getEnchantmentId(PERM_ENCHANTMENT_SLOT));
742 for (uint8_t ench = SOCK_ENCHANTMENT_SLOT1; ench < BONUS_ENCHANTMENT_SLOT; ++ench)
743 data << uint32_t(item->getEnchantmentId(ench));
744
745 data << uint64_t(item->getCreatorGuid()); // Item creator
746 data << uint32_t(item->getSpellCharges(0)); // Spell charges
747 data << uint32_t(item->getPropertySeed());
748 data << uint32_t(item->getRandomPropertiesId());
749 data << uint32_t(itemProperties->LockId);
750 data << uint32_t(item->getMaxDurability());
751 data << uint32_t(item->getDurability());
752 }
753 }
754#else
755 data << uint32_t(0); // unk
756 data << uint32_t(0); // unk
757 data << uint64_t(tradeData->getTradeMoney());
758 data << uint32_t(tradeData->getSpell());
759 data << uint32_t(TRADE_SLOT_COUNT);
760 data << uint32_t(0); // unk
761 data << uint8_t(tradeState ? 1 : 0);
762 data << uint32_t(TRADE_SLOT_COUNT);
763
764 uint8_t count = 0;
765 for (uint8_t i = 0; i < TRADE_SLOT_COUNT; ++i)
766 {
767 if (Item* item = tradeData->getTradeItem(TradeSlots(i)))
768 ++count;
769 }
770
771 data.writeBits(count, 22);
772
773 for (uint8_t i = 0; i < TRADE_SLOT_COUNT; ++i)
774 {
775 if (Item* item = tradeData->getTradeItem(TradeSlots(i)))
776 {
777 ObjectGuid creatorGuid = item->getCreatorGuid();
778 ObjectGuid giftCreatorGuid = item->getGiftCreatorGuid();
779
780 data.writeBit(giftCreatorGuid[7]);
781 data.writeBit(giftCreatorGuid[1]);
782 bool notWrapped = data.writeBit(!item->hasFlags(ITEM_FLAG_WRAPPED)); //wrapped
783 data.writeBit(giftCreatorGuid[3]);
784
785 if (notWrapped)
786 {
787 data.writeBit(creatorGuid[7]);
788 data.writeBit(creatorGuid[1]);
789 data.writeBit(creatorGuid[4]);
790 data.writeBit(creatorGuid[6]);
791 data.writeBit(creatorGuid[2]);
792 data.writeBit(creatorGuid[3]);
793 data.writeBit(creatorGuid[5]);
794 data.writeBit(item->getItemProperties()->LockId != 0);
795 data.writeBit(creatorGuid[0]);
796 }
797 data.writeBit(giftCreatorGuid[6]);
798 data.writeBit(giftCreatorGuid[4]);
799 data.writeBit(giftCreatorGuid[2]);
800 data.writeBit(giftCreatorGuid[0]);
801 data.writeBit(giftCreatorGuid[5]);
802 }
803 }
804
805 data.flushBits();
806
807 for (uint8_t i = 0; i < TRADE_SLOT_COUNT; ++i)
808 {
809 if (Item* item = tradeData->getTradeItem(TradeSlots(i)))
810 {
811 ObjectGuid creatorGuid = item->getCreatorGuid();
812 ObjectGuid giftCreatorGuid = item->getGiftCreatorGuid();
813
814 if (!item->hasFlags(ITEM_FLAG_WRAPPED))
815 {
816 data.WriteByteSeq(creatorGuid[1]);
817
818 data << uint32_t(item->getEnchantmentId(PERM_ENCHANTMENT_SLOT));
819 for (uint8_t enchant_slot = SOCK_ENCHANTMENT_SLOT1; enchant_slot < BONUS_ENCHANTMENT_SLOT; ++enchant_slot)
820 {
821 data << uint32_t(item->getEnchantmentId(enchant_slot));
822 }
823
824 data << uint32_t(item->getMaxDurability());
825
826 data.WriteByteSeq(creatorGuid[6]);
827 data.WriteByteSeq(creatorGuid[2]);
828 data.WriteByteSeq(creatorGuid[7]);
829 data.WriteByteSeq(creatorGuid[4]);
830
831 data << uint32_t(item->getEnchantmentId(REFORGE_ENCHANTMENT_SLOT));
832 data << uint32_t(item->getDurability());
833 data << uint32_t(item->getRandomPropertiesId());
834
835 data.WriteByteSeq(creatorGuid[3]);
836
837 data << uint32_t(0); // unk
838
839 data.WriteByteSeq(creatorGuid[0]);
840
841 data << uint32_t(item->getSpellCharges(0));
842 data << uint32_t(item->getPropertySeed());
843
844 data.WriteByteSeq(creatorGuid[5]);
845 }
846
847 data.WriteByteSeq(giftCreatorGuid[6]);
848 data.WriteByteSeq(giftCreatorGuid[1]);
849 data.WriteByteSeq(giftCreatorGuid[7]);
850 data.WriteByteSeq(giftCreatorGuid[4]);
851
852 data << uint32_t(item->getItemProperties()->ItemId);
853
854 data.WriteByteSeq(giftCreatorGuid[0]);
855
856 data << uint32_t(item->getStackCount());
857
858 data.WriteByteSeq(giftCreatorGuid[5]);
859
860 data << uint8_t(i); // slot
861
862 data.WriteByteSeq(giftCreatorGuid[2]);
863 data.WriteByteSeq(giftCreatorGuid[3]);
864 }
865 }
866#endif
867
868 SendPacket(&data);
869}
@ SMSG_TRADE_STATUS_EXTENDED
Definition Opcodes.hpp:333
Item * getTradeItem(TradeSlots slot) const
Definition TradeData.cpp:36
uint64_t getTradeMoney() const
Definition TradeData.cpp:80
uint32_t getSpell() const
Definition TradeData.cpp:65
TradeData * getTargetTradeData() const
Definition TradeData.cpp:31
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendTrainerList()

void WorldSession::sendTrainerList ( Creature creature)

Definition at line 403 of file NPCHandler.cpp.

404{
405 const auto trainer = creature->GetTrainer();
406 if (trainer == nullptr)
407 return;
408
409 if (!_player->canTrainAt(trainer))
410 {
411 GossipMenu::sendSimpleMenu(creature->getGuid(), trainer->Cannot_Train_GossipTextId, _player);
412 return;
413 }
414
415 std::string uiMessage;
416 if (trainer->UIMessage == "DMSG")
418 else
419 uiMessage = trainer->UIMessage;
420
421 const size_t size = 8 + 4 + 4 + 4 + uiMessage.size()
422 + (sObjectMgr.getTrainerSpellSetById(trainer->spellset_id)->size() * (4 + 1 + 4 + 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4));
423 WorldPacket data(SMSG_TRAINER_LIST, size);
424
425 data << creature->getGuid();
426 data << uint32_t(trainer->TrainerType);
427
428#if VERSION_STRING >= Cata
429 data << uint32_t(1); // Unk
430#endif
431
432 size_t count_p = data.wpos();
433 data << uint32_t(sObjectMgr.getTrainerSpellSetById(trainer->spellset_id)->size());
434
435 uint32_t count = 0;
436
437 auto its = sObjectMgr.getTrainerSpellSetById(trainer->spellset_id);
438
439 for (auto& spellItr : *sObjectMgr.getTrainerSpellSetById(trainer->spellset_id))
440 {
441 auto trainerSpell = spellItr;
442
443 const auto spellInfo = trainerSpell.castRealSpell != nullptr ? trainerSpell.castSpell : trainerSpell.learnSpell;
444 if (spellInfo == nullptr)
445 continue;
446
447 if (!_player->isSpellFitByClassAndRace(spellInfo->getId()))
448 continue;
449
450 if (spellItr.isStatic == 0)
451 {
452 // trainer has max level to train, skip all spells higher.
453 if (trainer->can_train_max_level)
454 if (spellItr.requiredLevel > trainer->can_train_max_level)
455 continue;
456
457 // trainer has min_skill_value, skip all spells lower
458 if (trainer->can_train_min_skill_value)
459 if (spellItr.requiredSkillLineValue < trainer->can_train_min_skill_value)
460 continue;
461
462 // trainer has max_skill_value, skip all spells higher
463 if (trainer->can_train_max_skill_value)
464 if (spellItr.requiredSkillLineValue > trainer->can_train_max_skill_value)
465 continue;
466 }
467
468 data << uint32_t(spellInfo->getId());
469 data << uint8_t(trainerGetSpellStatus(&trainerSpell));
470 data << uint32_t(trainerSpell.cost);
471#if VERSION_STRING < Cata
472 data << uint32_t(0); // Unk
473 data << uint32_t(trainerSpell.isPrimaryProfession);
474#endif
475 data << uint8_t(trainerSpell.requiredLevel);
476 data << uint32_t(trainerSpell.requiredSkillLine);
477 data << uint32_t(trainerSpell.requiredSkillLineValue);
478
479 // Get the required spells to learn this spell
480 uint8_t requiredSpellCount = 0;
481 const auto maxRequiredCount = TrainerSpell::getMaxRequiredSpellCount();
482 for (const auto requiredSpell : trainerSpell.requiredSpell)
483 {
484 if (requiredSpell == 0)
485 continue;
486
487 data << uint32_t(requiredSpell);
488 ++requiredSpellCount;
489
490 if (requiredSpellCount >= maxRequiredCount)
491 break;
492
493 const auto requiredSpells = sSpellMgr.getSpellsRequiredRangeForSpell(requiredSpell);
494 for (const auto& itr : requiredSpells)
495 {
496 data << uint32_t(itr.second);
497 ++requiredSpellCount;
498
499 if (requiredSpellCount > maxRequiredCount)
500 break;
501 }
502
503 if (requiredSpellCount >= maxRequiredCount)
504 break;
505 }
506
507 while (requiredSpellCount < maxRequiredCount)
508 {
509 data << uint32_t(0);
510 ++requiredSpellCount;
511 }
512
513#if VERSION_STRING >= Cata
514 data << uint32_t(trainerSpell.isPrimaryProfession && _player->getFreePrimaryProfessionPoints() != 0);
515 data << uint32_t(trainerSpell.isPrimaryProfession);
516#endif
517 ++count;
518 }
519
520 data.put<uint32_t>(count_p, count);
521 data << uiMessage;
522
523 sLogger.info("SendTrainerList : {} TrainerSpells in list", count);
524
525 SendPacket(&data);
526}
@ SMSG_TRAINER_LIST
Definition Opcodes.hpp:479
@ SS_WHAT_CAN_I_TEACH_YOU
uint32_t getFreePrimaryProfessionPoints() const
Definition Player.cpp:1043
bool canTrainAt(Trainer const *trainer)
Definition Player.cpp:10258
bool isSpellFitByClassAndRace(uint32_t spell_id) const
Definition Player.cpp:4271
static uint8_t getMaxRequiredSpellCount()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendVoidStorageTransferResult()

void WorldSession::sendVoidStorageTransferResult ( uint8_t  result)

Definition at line 17 of file VoidStorageHandler.cpp.

18{
19#if VERSION_STRING >= Cata
21 data << uint32_t(result);
22 SendPacket(&data);
23#endif
24}
@ SMSG_VOID_TRANSFER_RESULT
Definition Opcodes.hpp:1758
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetAccountData()

void WorldSession::SetAccountData ( uint32_t  index,
std::unique_ptr< char[]>  data,
bool  initial,
uint32_t  sz 
)
inline

Definition at line 164 of file WorldSession.h.

165 {
166 if (index >= 8)
167 return;
168
169 sAccountData[index].data = std::move(data);
170 sAccountData[index].sz = sz;
171
172 if (!initial && !sAccountData[index].bIsDirty) // Mark as "changed" or "dirty"
173 sAccountData[index].bIsDirty = true;
174 else if (initial)
175 sAccountData[index].bIsDirty = false;
176 }
Here is the caller graph for this function:

◆ SetAccountFlags()

void WorldSession::SetAccountFlags ( uint32_t  )
inline

Definition at line 117 of file WorldSession.h.

118 {
119 // TODO: add a config to determine what flags are allowed on the server.
120 // For now, override the db value depending on the AE Version.
121 // _accountFlags = flags;
122
123 switch (getAEVersion())
124 {
125 case 5875:
126 _accountFlags = 0;
127 break;
128 case 8606:
130 break;
131 case 12340:
133 break;
134 case 15595:
136 break;
137 case 18414:
139 break;
140 }
141 }
@ ACCOUNT_FLAG_XPACK_01
@ AF_FULL_MOP
@ AF_FULL_CATA
@ AF_FULL_WOTLK
uint32_t getAEVersion()
Here is the call graph for this function:

◆ SetClientBuild()

void WorldSession::SetClientBuild ( uint16_t  build)
inline

Definition at line 216 of file WorldSession.h.

216{ client_build = build; }

◆ SetInstance()

void WorldSession::SetInstance ( uint32_t  Instance)
inline

Definition at line 202 of file WorldSession.h.

202{ instanceId = Instance; }
Here is the caller graph for this function:

◆ SetLogoutTimer()

void WorldSession::SetLogoutTimer ( uint32_t  ms)
inline

Definition at line 180 of file WorldSession.h.

181 {
182 if (ms)
184 else
185 _logoutTime = 0;
186 }
Here is the caller graph for this function:

◆ SetPlayer()

void WorldSession::SetPlayer ( Player plr)
inline

Definition at line 162 of file WorldSession.h.

162{ _player = plr; }
Here is the caller graph for this function:

◆ SetSocket()

void WorldSession::SetSocket ( WorldSocket sock)
inline

Definition at line 158 of file WorldSession.h.

159 {
160 _socket = sock;
161 }
Here is the caller graph for this function:

◆ SystemMessage()

void WorldSession::SystemMessage ( const char *  format,
  ... 
)

Definition at line 542 of file WorldSession.cpp.

543{
544 char buffer[1024];
545 va_list ap;
546 va_start(ap, format);
547 vsnprintf(buffer, 1024, format, ap);
548 va_end(ap);
549
550 SendPacket(SmsgMessageChat(SystemMessagePacket(buffer)).serialise().get());
551}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ systemMessage()

template<typename... Args>
void WorldSession::systemMessage ( const std::string &  format,
Args &&...  args 
)
inline

Definition at line 949 of file WorldSession.h.

950 {
951 // Use the custom StringFormat function to format the string
952 std::string formattedMessage = AscEmu::StringFormat(format, std::forward<Args>(args)...);
953
954 // Send the formatted message via packet
955 sendSystemMessagePacket(formattedMessage);
956 }
void sendSystemMessagePacket(std::string &_message)
std::string StringFormat(std::string_view fmt, Args &&... args)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ trainerGetSpellStatus()

TrainerSpellState WorldSession::trainerGetSpellStatus ( TrainerSpell const *  trainerSpell) const

Definition at line 528 of file NPCHandler.cpp.

529{
530 if (trainerSpell == nullptr)
531 return TRAINER_SPELL_RED;
532
533 if (trainerSpell->castSpell == nullptr && trainerSpell->learnSpell == nullptr)
534 return TRAINER_SPELL_RED;
535
536 if (trainerSpell->learnSpell != nullptr && (_player->hasSpell(trainerSpell->learnSpell->getId()) || _player->hasDeletedSpell(trainerSpell->learnSpell->getId())))
537 return TRAINER_SPELL_GRAY;
538
539 if (trainerSpell->castRealSpell != nullptr && (_player->hasSpell(trainerSpell->castRealSpell->getId()) || _player->hasDeletedSpell(trainerSpell->castRealSpell->getId())))
540 return TRAINER_SPELL_GRAY;
541
542 if (trainerSpell->deleteSpell != 0 && _player->hasDeletedSpell(trainerSpell->deleteSpell))
543 return TRAINER_SPELL_GRAY;
544
545 if (trainerSpell->requiredLevel && _player->getLevel() < trainerSpell->requiredLevel)
546 return TRAINER_SPELL_RED;
547
548 if (trainerSpell->requiredSkillLine && _player->getSkillLineCurrent(trainerSpell->requiredSkillLine, true) < trainerSpell->requiredSkillLineValue)
549 return TRAINER_SPELL_RED;
550
551 if (trainerSpell->cost != 0 && !_player->hasEnoughCoinage(trainerSpell->cost))
552 return TRAINER_SPELL_RED;
553
554 for (const auto spellId : trainerSpell->requiredSpell)
555 {
556 if (spellId == 0)
557 continue;
558
559 if (!_player->hasSpell(spellId))
560 return TRAINER_SPELL_RED;
561
562 const auto spellsRequired = sSpellMgr.getSpellsRequiredRangeForSpell(spellId);
563 for (const auto& itr : spellsRequired)
564 {
565 if (!_player->hasSpell(itr.second))
566 return TRAINER_SPELL_RED;
567 }
568 }
569
570 return TRAINER_SPELL_GREEN;
571}
@ TRAINER_SPELL_GREEN
Definition Flags.hpp:15
bool hasDeletedSpell(uint32_t spellId) const
Definition Player.cpp:3930
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Unhandled()

void WorldSession::Unhandled ( WorldPacket recvPacket)
protected

Definition at line 670 of file WorldSession.cpp.

671{
672 recv_data.rfinish();
673}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Update()

uint8_t WorldSession::Update ( uint32_t  InstanceID)

Definition at line 115 of file WorldSession.cpp.

116{
118
119 if (!((++_updatecount) % 2) && _socket)
121
122 if (m_loginTime == 0)
124
125 if (InstanceID != instanceId)
126 {
127 // We're being updated by the wrong thread.
128 // "Remove us!" - 2
129 return 2;
130 }
131
132 // Socket disconnection.
133 if (!_socket)
134 {
135 // Check if the player is in the process of being moved. We can't delete him if we are.
137 {
138 // Abort..
139 return 0;
140 }
141
142 if (!_logoutTime)
144 }
145
146 while (auto packet = _recvQueue.pop())
147 {
148 if (packet.value() != nullptr)
149 {
150 // handling opcode
151 OpcodeHandlerRegistry::instance().handleOpcode(*this, *packet.value());
152
153 // set pointer to nullptr since it was processed
154 packet.value() = nullptr;
155
156 // If we hit this -> means a packet has changed our map.
157 if (InstanceID != instanceId)
158 return 2;
159
160 if (bDeleted)
161 return 1;
162 }
163 }
164
165 // If we hit this -> means a packet has changed our map.
166 if (InstanceID != instanceId)
167 return 2;
168
169 if (_logoutTime && (m_currMsTime >= _logoutTime) && instanceId == InstanceID)
170 {
171 // Check if the player is in the process of being moved. We can't delete him if we are.
173 {
174 // Abort..
175 return 0;
176 }
177
178 if (_socket == nullptr)
179 {
180 bDeleted = true;
181 LogoutPlayer(true);
182 return 1;
183 }
184 else
185 LogoutPlayer(true);
186 }
187
188 if (m_lastPing + WORLDSOCKET_TIMEOUT < static_cast<uint32_t>(UNIXTIME))
189 {
190 // Check if the player is in the process of being moved. We can't delete him if we are.
192 {
193 // Abort..
194 return 0;
195 }
196
197 // ping timeout!
198 if (_socket != nullptr)
199 {
200 Disconnect();
201 _socket = nullptr;
202 }
203
204 m_lastPing = static_cast<uint32_t>(UNIXTIME); // Prevent calling this code over and over.
205
206 if (!_logoutTime)
208 }
209
210 return 0;
211}
#define WORLDSOCKET_TIMEOUT
bool handleOpcode(WorldSession &session, WorldPacket &packet)
bool m_beingPushed
Definition Player.hpp:2175
void UpdateQueuedPackets()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatePlayerMovementVars()

void WorldSession::updatePlayerMovementVars ( uint16_t  opcode)
protected

Definition at line 65 of file MovementHandler.cpp.

66{
68 _player->m_isJumping = false;
69
71 _player->m_isJumping = true;
72
73 auto moved = true;
74 switch (opcode)
75 {
78 _player->m_isMovingFB = true;
79 break;
82 _player->m_isStrafing = true;
83 break;
84 case MSG_MOVE_JUMP:
85 _player->m_isJumping = true;
86 break;
87 case MSG_MOVE_STOP:
88 _player->m_isMovingFB = false;
89 break;
91 _player->m_isStrafing = false;
92 break;
94 _player->m_isJumping = false;
95 break;
96
97 default:
98 moved = false;
99 break;
100 }
101
102 if (moved)
104
106}
@ MOVEFLAG_SWIMMING
bool m_isMoving
Definition Player.hpp:618
bool m_isStrafing
Definition Player.hpp:620
bool m_isMovingFB
Definition Player.hpp:619
bool m_isTurning
Definition Player.hpp:621
Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ Player

friend class Player
friend

Definition at line 899 of file WorldSession.h.

◆ WorldSocket

friend class WorldSocket
friend

Definition at line 94 of file WorldSession.h.

Member Data Documentation

◆ _accountFlags

uint32_t WorldSession::_accountFlags
private

Definition at line 907 of file WorldSession.h.

◆ _accountId

uint32_t WorldSession::_accountId
private

Definition at line 906 of file WorldSession.h.

◆ _accountName

std::string WorldSession::_accountName
private

Definition at line 908 of file WorldSession.h.

◆ _latency

uint32_t WorldSession::_latency
private

Definition at line 928 of file WorldSession.h.

◆ _loggingOut

bool WorldSession::_loggingOut
private

Definition at line 925 of file WorldSession.h.

◆ _logoutTime

uint32_t WorldSession::_logoutTime
private

Definition at line 918 of file WorldSession.h.

◆ _player

Player* WorldSession::_player
private

Definition at line 900 of file WorldSession.h.

◆ _recvQueue

ThreadSafeQueue<std::unique_ptr<WorldPacket> > WorldSession::_recvQueue
private

Definition at line 922 of file WorldSession.h.

◆ _side

uint8_t WorldSession::_side
private

Definition at line 914 of file WorldSession.h.

◆ _socket

WorldSocket* WorldSession::_socket
private

Definition at line 901 of file WorldSession.h.

◆ _updatecount

uint8_t WorldSession::_updatecount
private

Definition at line 935 of file WorldSession.h.

◆ bDeleted

bool WorldSession::bDeleted

Definition at line 219 of file WorldSession.h.

◆ client_build

uint16_t WorldSession::client_build
private

Definition at line 932 of file WorldSession.h.

◆ deleteMutex

std::mutex WorldSession::deleteMutex

Definition at line 221 of file WorldSession.h.

◆ floodLines

uint32_t WorldSession::floodLines

Definition at line 940 of file WorldSession.h.

◆ floodTime

time_t WorldSession::floodTime

Definition at line 941 of file WorldSession.h.

◆ instanceId

uint32_t WorldSession::instanceId
private

Definition at line 934 of file WorldSession.h.

◆ isAddonMessageFiltered

bool WorldSession::isAddonMessageFiltered
private

Definition at line 694 of file WorldSession.h.

◆ language

uint32_t WorldSession::language

Definition at line 958 of file WorldSession.h.

◆ LoggingOut

bool WorldSession::LoggingOut
private

Definition at line 926 of file WorldSession.h.

◆ m_addonList

AddonsList WorldSession::m_addonList
private

Definition at line 697 of file WorldSession.h.

◆ m_bIsWLevelSet

bool WorldSession::m_bIsWLevelSet

Definition at line 896 of file WorldSession.h.

◆ m_clientTimeDelay

int32_t WorldSession::m_clientTimeDelay

Definition at line 223 of file WorldSession.h.

◆ m_currMsTime

uint32_t WorldSession::m_currMsTime

Definition at line 108 of file WorldSession.h.

◆ m_lastPing

uint32_t WorldSession::m_lastPing

Definition at line 109 of file WorldSession.h.

◆ m_loggingInPlayer

Player* WorldSession::m_loggingInPlayer

Definition at line 100 of file WorldSession.h.

◆ m_loginTime

uint32_t WorldSession::m_loginTime

Definition at line 110 of file WorldSession.h.

◆ m_moveDelayTime

int32_t WorldSession::m_moveDelayTime

Definition at line 222 of file WorldSession.h.

◆ m_MoverWoWGuid

WoWGuid WorldSession::m_MoverWoWGuid
private

Definition at line 916 of file WorldSession.h.

◆ m_muted

uint32_t WorldSession::m_muted

Definition at line 959 of file WorldSession.h.

◆ m_wLevel

float WorldSession::m_wLevel

Definition at line 895 of file WorldSession.h.

◆ mRegisteredAddonPrefixesVector

std::vector<std::string> WorldSession::mRegisteredAddonPrefixesVector
private

Definition at line 695 of file WorldSession.h.

◆ permissions

std::string WorldSession::permissions
private

Definition at line 923 of file WorldSession.h.

◆ sAccountData

std::array<AccountDataEntry, 8> WorldSession::sAccountData {}
private

Definition at line 920 of file WorldSession.h.

920{};

◆ sessionMovementInfo

MovementInfo WorldSession::sessionMovementInfo
private

Definition at line 904 of file WorldSession.h.


The documentation for this class was generated from the following files: